Vector2.new
Creates a Vector2.
Syntax
Vector2.new(x?: any, y?: any) -> Vector2
Parameters
| Parameter | Type | Description |
|---|---|---|
x? | any | The x value used by the call. |
y? | any | The y value used by the call. |
Returns
| Type | Description |
|---|---|
Vector2 | The returned Vector2. |
Description
Vector2.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 = Vector2.new(100, 50)
print(v.X, v.Y)
Notes
- Vector and CFrame operations return new value objects.