Vector2s created with the same coordinates do not refer to the same object. This created a confusing bug in my game, as I was using them to index tables and assumed they behaved like Vector3s.
I’m running Windows 10 on an 11th Gen Intel(R) Core™ i7-11700F @ 2.50GHz
Here’s a blank project with a Script in ServerScriptService that reproduces the problem.
inconsistent_vector_indentity.rbxl (57.0 KB)
Expected behavior
I would expect value “A” to have been overwritten with value “B”, since it was written to the table after “A” and seemingly had the same key.
I would also expect Vector2s to appear as their contents when used as keys like the Vector3 does in the image.
WheretIB
(WheretIB)
November 19, 2025, 11:43am
2
Hello.
This is correct, each Vector2 object is userdata type where each one has a separate identity.
Only Vector3 is special being a value type.
You can read our initial announcement to learn more: Native Luau Vector3 Beta
The important part referring to your report is here:
Vector3 is now a value type, which changes the result of rawequal for Vector3 values that were created separately, but hold the same value. This also means that rawequal(v, v) will return false if one of the vector components is NaN.
If you’ve used Vector3 as a table key, instances holding the same value will now be compared equally
We do not have plans to change any behaviors here.
1 Like
Alright, understandable, although I do wish this was in the documentation instead of buried in a forum post.
WheretIB
(WheretIB)
November 19, 2025, 12:00pm
4
We will add this information to the documentation.
2 Likes
IgnisRBX
(IgnisRBX)
November 19, 2025, 11:28pm
5
Hi @MikeMan0142 ,
I’ve updated the Vector3 docs with a note here. Thanks for flagging this.
https://create.roblox.com/docs/reference/engine/datatypes/Vector3
Best regards,
IgnisRBX
1 Like
I appreciate the change, but it seems to have been removed recently? I remember the page had mentioned something about atomic data types before it got reverted.