Hello, i have problem with regen button, need add wait(), but idk where. It regen too fast.
model = script.Parent.Parent messageText = "" message = Instance.new("Message") message.Text = messageText backup = model:clone() enabled = true function regenerate() message.Parent = game.Workspace model:remove() wait(0) model = backup:clone() model.Parent = game.Workspace model:makeJoints() message.Parent = nil script.Disabled = true script.Parent.BrickColor = BrickColor.new(26)--Black wait(150)-- here is something, but don't work. script.Parent.BrickColor = BrickColor.new(104)--Purple script.Disabled = false end function onTouched() if enabled then regenerate() end end script.Parent.Touched:connect(onTouched)
model = script.Parent.Parent messageText = "" message = Instance.new("Message") message.Text = messageText backup = model:clone() enabled = true function regenerate() message.Parent = game.Workspace model:remove() wait(2) --Change this to two model = backup:clone() model.Parent = game.Workspace model:makeJoints() message.Parent = nil script.Disabled = true script.Parent.BrickColor = BrickColor.new(26)--Black wait(150)--This is how long until it is regenable again script.Parent.BrickColor = BrickColor.new(104)--Purple script.Disabled = false end function onTouched() if enabled then enabled = false regenerate() enabled = true --Added a debounce for ya. end end script.Parent.Touched:connect(onTouched)