function aimdown()
print("yes")
end
cas:BindAction("onaimdown", aimdown, false, Enum.KeyCode.Q)
why is this firing twice?
function aimdown()
print("yes")
end
cas:BindAction("onaimdown", aimdown, false, Enum.KeyCode.Q)
why is this firing twice?
Your problem is that it’s firing aimdown for the press starting and the press ending.
The below code fixes that.
local cas = game:GetService("ContextActionService")
function aimdown(actionName, inputState, inputObj)
if inputState == Enum.UserInputState.Begin then
print("yes")
end
end
cas:BindAction("onaimdown", aimdown, false, Enum.KeyCode.Q)