I am not skilled enough to do something like this so I used someone's free model. This script regenerates parts but there is 2 things I don't like about it. One is that when you touch the block, it regenerates the part every 0.1 second until you get off it. I put a wait before "regenerate()" and it was regenerating parts every 10 seconds which is what I want. However, if the player touches the block 5 times and walks away, it'll regenerate the parts every 10 seconds until it regenerates 5 times because that's how many times the player touched it. How can I make this that once the player touches the block it regenerates all parts and then waits 10 seconds before the player can touch the block again to regenerate?
model = script.Parent.Parent
backup = model:clone()
enabled = true
function regenerate()
model:remove()
model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
script.Disabled = true
wait(10)
script.Disabled = false
end
function onHit(hit)
if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then
regenerate()
end
end
script.Parent.Touched:connect(onHit)
