Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont my magnitude script delete the brick when away from it?

Asked by
NexeusX 137
7 years ago
Edited 7 years ago

I want this script to remove its parent when a player is not near it, but it will not work why?



while true do for i,v in pairs(game.Players:GetChildren()) do if (v.Character.UpperTorso.Position - script.Parent.Position).magnitude >= 10 then script.Parent:remove() print("Perfect") end end wait() end

1 answer

Log in to vote
0
Answered by
Etheroit 178
7 years ago

remove() function doesnt remove script. Its just changing it's parent to nil. Use :Destroy() function instead of :remove(). Make sure is characters type set to R15 too.Try disable Filtering Enabled if its enabled too

Ad

Answer this question