how to make a regen clone with a cooldown?
if did you mean a button that regens a model when touching
create a script inside that button with this!:
local waitingtime = 10
local cooldown = false -- Cooldown is false
local instance = ... --For regen Instance location! example: workspace.Part
local oldcolor = script.Parent.Color -- button old color
local instancecframe = nil
local cloned = instance:Clone() -- Clones the instance and saves it
script.Parent.Touched:Connect(function(touchedpart)
if touchedpart.Parent:FindFirstChildOfClass("Humanoid") then --check if it is a player, or that it has a humanoid.
if cooldown == false then -- makes a filter if the cooldown is disabled
cooldown = true -- Cooldown on
local clone2 = cloned:Clone() -- Clones a clone of instance
if instance then -- checks if the instance exists
instance:Destroy()
end
script.Parent.Color = Color3.fromRGB(213, 31, 31) -- Makes the button color red
task.wait(0.1)
clone2.Parent = workspace -- sets parent to workspace
instance = clone2
task.wait(waitingtime) -- Wait precisely a few seconds specified in waitingtime so that when it stops waiting the following is executed
script.Parent.Color = oldcolor -- Makes the button color red
cooldown = false -- Cooldown off
end
end
end)
no, the regen clone cooldown click