---
title: "Datatypes"
description: "Math, transform and colour values available to Glorpia scripts."
canonical: "https://docs.glorpia.com/scripting/datatypes"
markdown: "https://docs.glorpia.com/scripting/datatypes.md"
---
# Datatypes

Math, transform and colour values available to Glorpia scripts.

**Category:** Scripting / API

## Numeric variables

Datatype constructors accept numeric variables as well as number literals. This applies to Vector2, Vector3, CFrame and Color3 / Colour3 constructors.

Scalar numeric values support `inf` and `-inf`. Number properties store floating-point infinity when the property permits it; integer properties map those values to their positive or negative integer limits. Property-specific ranges still apply to bounded properties.

```luau
local x = 12
local y = 5
local z = -3
local red = 88
local green = 255
local blue = 106

local position = Vector3.new(x, y, z)
local colour = Colour3.fromRGB(red, green, blue)

workspace.Part.Position = position
workspace.Part.Colour3 = colour
```

## UDim / UDim2

| Name | Type | Description |
| --- | --- | --- |
| `UDim.new(scale, offset)` | constructor | Creates a one-axis GUI scale/offset value. |
| `UDim.Scale / Offset` | number | The scale and pixel-offset components. |
| `UDim2.new(xScale, xOffset, yScale, yOffset)` | constructor | Creates a two-axis GUI scale/offset value. |
| `UDim2.X / Y` | UDim | Horizontal and vertical dimensions. |
| `UDim2.Width / Height` | UDim | Aliases for X and Y. |

```luau
local size = UDim2.new(0, 100, 0, 50)
local radius = UDim.new(0, 8)

workspace.Part.BillboardGui.TextLabel.Size = size
workspace.Part.BillboardGui.TextLabel.UICorner.CornerRadius = radius
```

## Vector2

| Name | Type | Description |
| --- | --- | --- |
| `Vector2.new(x, y)` | constructor | Creates a Vector2. |
| `Vector2.zero` | constant | 0, 0. |
| `X / Y` | number | Components. |
| `Magnitude / Unit` | property | Length and normalised vector. |
| `Dot(other)` | method | Dot product. |
| `+ / -` | operator | Vector addition and subtraction. |
| `* /` | operator | Multiply or divide by a number. |
| `==` | operator | Component equality. |

## Vector3

| Name | Type | Description |
| --- | --- | --- |
| `Vector3.new(x, y, z)` | constructor | Creates a Vector3. |
| `Vector3.zero` | constant | 0, 0, 0. |
| `Vector3.xAxis / yAxis / zAxis` | constant | Unit axes. |
| `X / Y / Z` | number | Components. |
| `Magnitude / Unit` | property | Length and normalised vector. |
| `Dot(other)` | method | Dot product. |
| `Cross(other)` | method | Cross product. |
| `Lerp(goal, alpha)` | method | Interpolates toward another Vector3 with alpha clamped from 0 to 1. |
| `+ / -` | operator | Vector addition and subtraction. |
| `* /` | operator | Multiply or divide by a number. |
| `unary -` | operator | Negates all components. |
| `==` | operator | Component equality. |

## CFrame

| Name | Type | Description |
| --- | --- | --- |
| `CFrame.new(x, y, z)` | constructor | Creates a translation CFrame. |
| `CFrame.Angles(x, y, z)` | constructor | Creates an XYZ rotation CFrame using radians. |
| `CFrame.fromEulerAnglesYXZ(x, y, z)` | constructor | Creates a YXZ-ordered rotation CFrame using X, Y and Z rotation angles in radians. |
| `CFrame.lookAt(position, target)` | constructor | Creates a CFrame pointing from position toward target. |
| `CFrame.identity` | constant | Identity transform. |
| `Position / X / Y / Z` | property | Position values. |
| `LookVector / RightVector / UpVector` | Vector3 | Orientation basis vectors. |
| `Rotation` | CFrame | Rotation-only transform. |
| `Lerp(goal, alpha)` | method | Interpolates position and rotation toward another CFrame. |
| `Inverse()` | method | Returns the inverse transform. |
| `PointToWorldSpace(point)` | method | Transforms a point. |
| `VectorToWorldSpace(vector)` | method | Transforms a direction vector. |
| `CFrame * CFrame` | operator | Composes two transforms. |
| `CFrame * Vector3` | operator | Transforms a point into world space. |
| `CFrame + Vector3 / CFrame - Vector3` | operator | Offsets the CFrame position while preserving rotation. |

## Color3 / Colour3

| Name | Type | Description |
| --- | --- | --- |
| `Color3.new / Colour3.new` | constructor | Creates a colour using 0 to 1 components. |
| `Color3.fromRGB / Colour3.fromRGB` | constructor | Creates a colour using 0 to 255 channels. |
| `R / G / B` | number | 0 to 1 colour channels. |
| `Lerp(goal, alpha)` | method | Interpolates toward another Color3 / Colour3 with alpha clamped from 0 to 1. |
| `==` | operator | Compares colour channels. |

```luau
local green = Colour3.fromRGB(88, 255, 106)
workspace.Part.Colour = green
```

## ColourSequence / NumberSequence

| Name | Type | Description |
| --- | --- | --- |
| `ColorSequence.new(start, end) / ColourSequence.new(start, end)` | constructor | Creates the two colour endpoints used by UIGradient. |
| `ColourSequence.Start / End` | Colour3 | Read-only endpoint colours. |
| `NumberSequence.new(start, end)` | constructor | Creates two number endpoints. UIGradient transparency values are from 0 through 1. |
| `NumberSequence.Start / End` | number | Read-only endpoint values. |

```luau
local colours = ColourSequence.new(
    Colour3.fromRGB(255, 80, 120),
    Colour3.fromRGB(80, 145, 255)
)
local transparency = NumberSequence.new(0, 0.25)
```
