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

How to create a part every x seconds but have them destroyed after y seconds of existing?

Let x and y be arbitrary positive integers. In this while loop, how do I make every new part get destroyed after it has existed for y seconds?

while true do
p = Instance.new("Part",game.Workspace)
wait(x)
end

1 answer

✓ Accepted answer

Easy here: Destroy() command lets thing disappear from game. Here is it:

function creating()
	p = Instance.new("Part",game.Workspace)
	wait(y)
	p:Destroy()
end
while true do
	creating()
	wait(x)
end

1 comment

0

A better solution would be to use the debris service

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