Size is a vector 3 and so you must create a vector 3 when you're trying to compare it. Also, you want to always use higher or equal since the size might not be exactly the size you're trying to compare it to. Finally, since you can't right out compare vector3 you want to add magnitude so you compare the length of the vector. Here's how you would do it:
local part = game.Workspace:FindFirstChild("Part")
if part.Size.Magnitude >= Vector3.new(2,2,2).Magnitude then
game.Players.LocalPlayer.PlayerGui.size.Frame.Textlabel.Text = "Meteor"
end
Let me know how it goes!
11 comments
12:28:16.918 - ServerScriptService.Meteor:3: attempt to compare Vector3
You can’t compare Vector3’s using <=, <, >, or >= because Roblox doesn’t implement __lt nor __le metamethods.
Oh right, I totally forgot about that. Let me edit my answer. Sorry!
Fixed it, forgot to add magnitude. It should work now. :)
Didn't work
Did you define the variable "part" to the part you're looking for?
Make sure the part has a unique name so it doesn't find another part. You could also simply put the script under the part in workspace then define part with part = script.Parent
Didn't work still
What is wrong? It is working fine for me. Can you show your whole script so I can check if you're doing it right.
Put a Print("Part is bigger") just to confirm that it does detect that the part is bigger. If the text is not changing, then maybe you're not calling it properly.
Any updates on how it went?