Attempt to compare userdata?

print(hit.Size)
if hit.Size < Vector3.new(0.05, 1, 1) then
	hit:Destroy()
end

Not sure why this errors? printing hit.Size prints a Vector3, so this should work imo

1 Like

Because Roblox doesn’t overload the < and <= operators on Vector3. Compare magnitudes instead.

It’s not the datatype that matters, what matters is if the operator was overloaded to work.

You can’t compare Vectors with each other. You would either have to compare each size axis on its own
Ex:

if hit.Size.X <3 and hit.Size.Z <3 then

or just use magnitude if the size isn’t important to each axis

if hit.Size.magnitude < Vector3.new(0.05, 1, 1).magnitude then
1 Like

In order to compare volume, multiply all vectors of it.

if (hit.Size.X * hit.Size.Y * hit.Size.Z) < 0.05 then
    hit:Destroy()
end

-- or individual vector comparisons.

if hit.Size.X < 0.05 and hit.Size.Y < 1 and hit.Size.Z < 1 then
    hit:Destroy()
end
1 Like