Roblox Wiki
Advertisement
Roblox Wiki
Regenbutton

A typical Regeneration button

Regeneration (also known as regen) in ROBLOX means a script or button that makes a model regenerate or disappear and re-appear. Usually used to remove unnecessary models like cars or to fix parts/models that had been moved in-game like bowling alleys. But usually scripts do this today instead of you clicking the button or having to touch the button.

The Script

The regeneration script by ROBLOX is as follows:

model = game.Workspace.MyModelName
messageText = "Regenerating MyModelName..."

message = Instance.new("Message")
message.Text = messageText
backup = model:clone()

while true do
	wait(300) 

	message.Parent = game.Workspace
	model:remove()

	wait(4) 

	model = backup:clone()
	model.Parent = game.Workspace
	model:makeJoints()
	message.Parent = nil
end

The script above tells the computer to find the model "MyModelName" and regenerate it every 300 seconds, while printing a message on the screen saying "Regenerating MyModelName" for 4 seconds.

model = game.Workspace.MyModelName
messageText = "Regenerating MyModelName..."
while true do
	wait(300) 

	message.Parent = game.Workspace
	model:remove()

This part tells the computer that every 300 seconds, if true, to remove the selected model.

model = backup:clone()
	model.Parent = game.Workspace
	model:makeJoints()
	message.Parent = nil

This part tells the computer to replace the recently removed model.

Regeneration Buttons

Regeneration buttons are usually bright purple coloured buttons that are placed next to the selected model to regenerate.

model = game.Workspace.MyModelName -- Replace with your model name
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)

The script above is the regenerate button script. It combines the common regenerate script with an OnTouch function.

Advertisement