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

What was the easy way to insert a part into the workspace for a set amount of time?

Rusty scripter here. I haven't scripted for a while and so I've forgotten how to do certain things. One of the things I remember you could do was to insert an object into the workspace for a set amount of time before it was destroyed. It would look something like this:

workspace.addTemporaryInstance(part, 5)

This would inset the part into the workspace for 5 seconds after which the part would be destroyed.

As implied, I've forgotten how to do this. Any ideas?

1 answer

✓ Accepted answer

AFAIK there was no official function for this.

You could write something like this:

local function spawnTempPart(parent,part,time)
part.Parent = parent
wait(time)
if part then part:Destroy() end
return

EDIT: Found this: Debris:AddItem() developer.roblox.com/en-us/api-reference/class/Debris

so

part.Parent = game.Workspace
Debris:AddItem(part, 5)

1 comment

0

Thank you so much! Debris was exactly what I was looking for.

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