debounce=false regen={}last={}for Q,c in ipairs(script.Parent.Parent:GetChildren())do if c~=script.Parent then table.insert(regen,c:clone())table.insert(last,c)end end script.Parent.Touched:connect(function(Q)if Q.Parent~=nil then if game.Players:playerFromCharacter(Q.Parent)~=nil and debounce==false then debounce=true for Q,c in ipairs(last)do if c.Parent==script.Parent.Parent then end end last={}for Q,c in ipairs(regen)do local k=c:clone()table.insert(last,k)k.Parent=script.Parent.Parent pcall(function()k:MakeJoints()end)end script.Parent.BrickColor=BrickColor.new(26)wait(2)script.Parent.BrickColor=BrickColor.new(104)debounce=false end end end)
--Put the objects you want regenned in the model, if the object's parent is changed it will not be deleted when the button is pushed again.
debounce = false
regen = {}
last = {}
for a, b in ipairs(script.Parent.Parent:GetChildren()) do
	if b ~= script.Parent then
		table.insert(regen, b:clone())
		table.insert(last, b)
	end
end
script.Parent.Touched:connect(function(hit)
	if hit.Parent ~= nil then
		if game.Players:playerFromCharacter(hit.Parent) ~= nil and debounce == false then
			debounce = true
			for a, b in ipairs(last) do
				if b.Parent == script.Parent.Parent then
				end
			end
			last = {}
			for a, b in ipairs(regen) do
				local c = b:clone()
				table.insert(last, c)
				c.Parent = script.Parent.Parent
				pcall(function()
					c:MakeJoints()
				end)
			end
			script.Parent.BrickColor = BrickColor.new(26)
			wait(2)
			script.Parent.BrickColor = BrickColor.new(104)
			debounce = false
		end
	end
end)
