--To make the button work, group this with anything you want to be regened. this works with all models,
--You just have to group it with them. anything, bricks, anything.


model = script.Parent.Parent

backup = model:clone()
enabled = true

function regenerate()
	model:remove()

	wait(0.3) --how many seconds it takes to regen

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

	script.Disabled = true
	script.Parent.BrickColor = BrickColor.new(26) --basically black... (it go's black when you regen it
	wait(0.3) --how much sec it takes to regen
	script.Parent.BrickColor = BrickColor.new(104) --purple (just a purple brick (exept it regen)
	script.Disabled = false
end

function onHit(hit)
	if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then --if a humanoid touches it then...
		regenerate()
	end
end

script.Parent.Touched:connect(onHit)
