Hello fellow developers, I have a script in the game that spawns a car when the player steps on the button, but I cannot figure out how to make a certain amount of time before the player can spawn another car Please help…
Here is script number one
system = script.Parent
model = system.Station –
backup = model:Clone()
regen = system.Regen
function checkRegen()
if regen.Value == 1 then
wait(1)
model = backup:Clone()
model.Parent = system
model:MakeJoints()
end
end
regen.Changed:connect(checkRegen)
and script number two is
button = script.Parent
regen = button.Parent.Regen
local debounce = false
function onTouch(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h ~= nil and debounce == false then
debounce = true
button.BrickColor = BrickColor.Black()
regen.Value = 1
wait(1)
regen.Value = 0
wait(5)
button.BrickColor = BrickColor.new(104)
debounce = false
end
end
button.Touched:connect(onTouch)