I’m using ContextActionService for some keycode binds, and the debounces I’m trying aren’t working.
local CAS = game:GetService("ContextActionService")
local Magic = game.ReplicatedStorage.Remotes.Magic
local dcd = false
local lcd = false
function Divinity(actionName, inputState, inputObj)
if dcd == false then
dcd = true
if inputState == Enum.UserInputState.Begin then
Magic:FireServer('Ascension Divinity')
wait(3)
dcd = false
end
end
end
function Levitate(actionName, inputState, inputObj)
if dcd == false then
dcd = true
if inputState == Enum.UserInputState.Begin then
Magic:FireServer('Levitate')
end
elseif dcd == true then
Magic:FireServer('LevitateOff')
end
end
CAS:BindAction('Ascension Divinity', Divinity, false, Enum.KeyCode.E)
CAS:BindAction('Levitate', Levitate, false, Enum.KeyCode.R)
What’s the correct way to add a debounce here?