Feature Request
I would like to propose a Workspace property that allows supported Vector3 Instance properties to return Luau’s native vector datatype instead of Vector3.
Proposed property:
Workspace.InstancesUseVector
When enabled, reading a supported Instance property that normally returns a Vector3 would return a Luau vector instead.
For example:
local Position = Part.Position
would normally produce a Vector3, but with:
Workspace.InstancesUseVector = true
it would produce a Luau vector.
Why This Is Useful
Luau’s native vector datatype is designed for efficient vector operations and is particularly useful for performance-sensitive code.
However, Instance properties still commonly return Vector3.
This means a system that wants to consistently use Luau vectors can be forced to convert values immediately after reading them from Instances.
For example:
local Position = Part.Position
Position = vector.create(
Position.X,
Position.Y,
Position.Z
)
The conversion itself is unnecessary if the developer already intends to perform the computation using Luau vectors.
With the proposed property:
Workspace.InstancesUseVector = true
local Position = Part.Position
Position would already be a Luau vector.
The data can therefore remain in the native Luau vector representation as it moves from the engine into Luau code.
Opt-In For Compatibility
The default behavior should remain unchanged:
Workspace.InstancesUseVector = false
Existing experiences would therefore continue receiving Vector3 values.
Developers who want Instance properties to return native Luau vectors could explicitly enable the behavior.
This makes the feature backwards-compatible while giving performance-sensitive experiences a way to opt into the more appropriate datatype.
No Conversion API Required
I would also prefer this to happen directly at the Instance property boundary rather than requiring developers to manually convert every returned value.
For example, without this feature:
local Position = Part.Position
local Direction = vector.create(
Position.X,
Position.Y,
Position.Z
)
With this feature:
local Direction = Part.Position
The latter is both simpler and avoids requiring every developer to repeatedly perform the same conversion.
Proposed API
Workspace.InstancesUseVector: boolean
Default:
false
Behavior:
-- Default
local Position = Part.Position -- Vector3
-- With InstancesUseVector enabled
local Position = Part.Position -- vector
This would provide a simple opt-in mechanism for keeping vector data in Luau’s native representation when reading it from Instances, eliminating unnecessary conversion work in vector-heavy systems while preserving existing behavior by default.