✓ Accepted answer
You can't actually make the part come back into the workspace unless you are talking about a completely new part. When you use the Destroy() you are completely removing it from your game until the server restarts. If you are talking about a completely new part, you would need to put the script somewhere else because all of the children of the part would also be destroyed. I myself would just change the parent of the part and change it back after 90 seconds. That would look something like this:
debounce = false
script.Parent.Touched:Connect(function()
if not debounce then
debounce = true
script.Parent = game.ServerStorage
wait(90)
script.Parent = workspace
debounce = false
end
end)
Also, you should no longer be using :connect (talking about the lowercase "c"). That has been deprecated meaning it will no longer work in a later update, as a result, you should use ":Connect", with an uppercase "c". Hope I helped you out.
-cmgtotalyawesome
EDIT: If you were unsure of what the debounce did, it is just a way to keep the function from running over and over again, making it take longer than 90 seconds to put the part back, and also to avoid errors from the function.
3 comments
Accidentally said this on my answer also but, please accept my answer if it helped you out.
I'd be glad to. How can I do that for you?
Side note: I couldn't quite seem to get the script to work eithe.