Hello, can someone please tell me why this cooldown won’t work?
local debounce = false
game.ReplicatedStorage.orderEvent.OnServerEvent:Connect(function(plr, username, order)
if debounce == false then
debounce = true
end
for i, v in pairs(game.Players:GetPlayers()) do
local Layout = v.PlayerGui.orderBoardGUI.Frame.ordersFrame.Layout
local clone = Layout:Clone()
clone.Visible = true
clone.order.Text = order
clone.username.Text = username
clone.Parent = Layout.Parent
plr.leaderstats.Points.Value += 1
wait(10)
debounce = false
end
end)
I think the first end under debounce = true should be over end)
local debounce = false
game.ReplicatedStorage.orderEvent.OnServerEvent:Connect(function(plr, username, order)
if debounce == false then
debounce = true
for i, v in pairs(game.Players:GetPlayers()) do
local Layout = v.PlayerGui.orderBoardGUI.Frame.ordersFrame.Layout
local clone = Layout:Clone()
clone.Visible = true
clone.order.Text = order
clone.username.Text = username
clone.Parent = Layout.Parent
plr.leaderstats.Points.Value += 1
wait(10)
debounce = false
end
end
end)