Trying to relearn lua after returning after several months, how would I add a cooldown to this script?
What would I use?
local keyword = "MYSAFEPLACE" -- Keyword Here
local bridgefolder = game.Workspace["Moving Bridges"]
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg == keyword then
print("Keyword Entered!") --Do Stuff Here
bridgefolder.B1.PressTween.Disabled = false
bridgefolder.B2.PressTween.Disabled = false
end
end)
end)
local keyword = "MYSAFEPLACE" -- Keyword Here
local bridgefolder = game.Workspace["Moving Bridges"]
local debounce = {}
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg == keyword then
if debounce[player] ~= nil then return end
debounce[player] = true
print("Keyword Entered!") --Do Stuff Here
bridgefolder.B1.PressTween.Disabled = false
bridgefolder.B2.PressTween.Disabled = false
task.wait(1)
debounce[player] = nil
end
end)
end)
local keyword = "MYSAFEPLACE" -- Keyword Here
local bridgefolder = game.Workspace["Moving Bridges"]
local debounce = {}
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg == keyword then
if debounce[player] ~= nil then return end
debounce[player] = true
print("Keyword Entered!") --Do Stuff Here
bridgefolder.B1.PressTween.Disabled = false
bridgefolder.B2.PressTween.Disabled = false
task.wait(1)
debounce[player] = nil
end
end)
end)