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

How to make a script that removes a model after it's been placed?

Hello.

I am trying to make this script I described above in the topic.

I wish to make a script that deletes the block I place in my game after a few seconds.

This model is called Grenade and it is placed in the workspace.

And this is the script I effortlessly tried to make it work:

local Part = Workspace.Grenade
wait (5)
Part:Destroy()
Part.Parent = Workspace

Thank you.

2 answers

✓ Accepted answer

###The global variable Workspace is deprecated, you're looking for workspace. Use a ChildAdded event to listen for a child being added.

game.Workspace.ChildAdded:Connect(function(child)
    if child.Name == "Grenade" then
        wait(5)
        child:Destroy()
    end
end)
local Part = Workspace.Grenade
game:GetService("Debris"):AddItem(Part, 5)

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