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
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