Edit the Script
Copy and paste this code into the Script you just created. Replace "MyModelName" with the name of your model.
_____________________________________________________
model = game.Workspace.MyModelName
messageText = "Regenerating MyModelName..."
message = Instance.new("Message")
message.Text = messageText
backup = model:clone()
while true do
wait(300) -- regenerate this model every 300 seconds
message.Parent = game.Workspace
model:remove()
wait(4) -- display regen message for 4 seconds
model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
end
Regeneration Buttons
To create a regeneration button, create a script, place it in the button, and copy this code into the script:
_______________________________________________________________________
model = game.Workspace.MyModelName
messageText = "Regenerating MyModelName..."
message = Instance.new("Message")
message.Text = messageText
backup = model:clone()
enabled = true
function regenerate()
message.Parent = game.Workspace
model:remove()
wait(4) -- display regen message for 4 seconds
model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
enabled = false
wait(30)
enabled = true
end
function onHit(hit)
if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then
regenerate()
end
end
script.Parent.Touched:connect(onHit)
|