Vector3.new
Creates a Vector3; also callable directly as Vector3(1, 2, 3) and copy-constructs from another Vector3.
Syntax
Vector3.new(x?: any, y?: any, z?: any) -> Vector3
Parameters
| Parameter | Type | Description |
|---|---|---|
x? | any | The x value used by the call. |
y? | any | The y value used by the call. |
z? | any | The z value used by the call. |
Returns
| Type | Description |
|---|---|
Vector3 | The returned Vector3. |
Description
Vector3.new is part of the Data types library. Vector and CFrame values are VM userdata with operator overloads; operations return new value objects.
Each call creates or returns a fresh object or value that you can store and pass to other functions.
Example
local v = Vector3.new(1, 2, 3)
print(v.X, v.Y, v.Z, v.Magnitude)
Notes
- Vector and CFrame operations return new value objects.