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

How to remove a part after it has reach a certain Y position ?

Hello, I'd like to know why my script doesn't work.

local SnowFlake = script.Parent

if SnowFlake.Position.Y == -1
	then
	SnowFlake:Destroy()
	print("destroyed") -- DEBUG
end

SnowFlake (part) => Script (script)

Thanks

2 answers

✓ Accepted answer

The problem with this script is it only fires the if statement once. You have to have a loop. Also, I am sure that where the "then" was is not the proper context. Always put that after what you are testing.

local SnowFlake = script.Parent

while SnowFlake then
	if SnowFlake.Position.Y == -1 then
		SnowFlake:Destroy()
		print("Destroyed") -- DEBUG
	end
	wait()
end

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