Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.