local m={model}local C={model}local r=game.Workspace:children()for v=1,#r,1 do if r[v].Name=="\102\108\097\103\115"then table.insert(m,r[v]:clone())table.insert(C,r[v].Name)end end function regen()for r=1,#m,1 do(game.Workspace:findFirstChild(C[r])):remove()new_thing=m[r]:clone()new_thing.Parent=game.Workspace new_thing:makeJoints()end end function onTouched()script.Parent.BrickColor=BrickColor.new(26)regen()wait(10)script.Parent.BrickColor=BrickColor.new(104)debounce=false end script.Parent.ClickDetector.MouseClick:connect(onTouched)


local everything = {model}
local names = {model}

local children = game.Workspace:children()
for i=1,#children do
	if (children[i].Name == "flags") then -- Replace the name with your models's name.
		table.insert(everything, children[i]:clone())
		table.insert(names, children[i].Name)
	end
end


function regen()
	for i=1,#everything do
		game.Workspace:findFirstChild(names[i]):remove() -- Dont mess with this stuff.
		new_thing = everything[i]:clone()
		new_thing.Parent = game.Workspace
		new_thing:makeJoints()
	end
end

function onTouched()		
		script.Parent.BrickColor = BrickColor.new(26)

		regen()
		wait(10)-- This is how long it takes untill the regen button will work again.


		script.Parent.BrickColor = BrickColor.new(104)


		debounce = false
end

 script.Parent.ClickDetector.MouseClick:connect(onTouched)
