Hi, I’m currently trying to create a script to compare coordinates.
My goal is this: if the coordinates of one part are too close to another, it is deleted.
My current script (dont work):
wait(2)
for i, v in pairs(script.Parent.Parent:GetChildren()) do
print(v)
if v.Position - script.Parent.Position <= Vector3.new(40, v.Position.Y, v.Position.Z) then
print("del")
script.Parent:Destroy()
end
end
for i, v in pairs(script.Parent.Parent:GetChildren()) do
print(v)
if (v.Position - script.Parent.Position).Magnitude <= 40 then
print("del")
script.Parent:Destroy()
end
end
This essentially does the same thing as you did, except it uses magnitude, which is the size of the difference between the two positions.