Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local model = game.Workspace.MyModelName
- local message = Instance.new("Message")
- message.Text = "Regenerating "..model.Name
- local backup = model:clone()
- local regenerating = false
- function regenerate()
- --Don't regenerate again if we're already doing it!
- if regenerating then
- return
- else
- regenerating = true
- end
- model:Destroy()
- -- Display the regen message for 4 seconds
- message.Parent = game.Workspace
- wait(4)
- message.Parent = nil
- -- Put the copied model back into workspace
- model = backup:clone()
- model.Parent = game.Workspace
- model:makeJoints()
- -- After 30 seconds, allow the model to be regenerated again
- wait(30)
- regenerating = false
- end
- --Connect a function that regenerates the model when a player touches the button
- script.Parent.Touched:connect(function(hit)
- if hit.Parent:FindFirstChild("Humanoid") then
- regenerate()
- end
- end)
Add Comment
Please, Sign In to add comment