- can anyone help? im making a custom playermodule to handle movement and for some reason whenever ANY input is made all of the contextaction binded functions fire even if the input isn’t the correct keycode
function Keyboard:_BindContextActions()
local handleMoveForward = function(actionName, inputState, inputObject)
self.forwardValue = (inputState == Enum.UserInputState.Begin) and -1 or 0
self:_UpdateMovement(inputState)
end
local handleMoveBackward = function(actionName, inputState, inputObject)
self.backwardValue = (inputState == Enum.UserInputState.Begin) and 1 or 0
self:_UpdateMovement(inputState)
end
local handleMoveRight = function(actionName, inputState, inputObject)
self.rightValue = (inputState == Enum.UserInputState.Begin) and -1 or 0
self:_UpdateMovement(inputState)
end
local handleMoveLeft = function(actionName, inputState, inputObject)
self.leftValue = (inputState == Enum.UserInputState.Begin) and 1 or 0
self:_UpdateMovement(inputState)
end
local handleJumpAction = function(actionName, inputState, inputObject)
self.jumpRequested = self.jumpEnabled and (inputState == Enum.UserInputState.Begin)
self:_UpdateJump(inputState)
end
ContextActionService:BindAction("MoveForward", handleMoveForward, false, Enum.KeyCode.W)
ContextActionService:BindAction("MoveBackward",handleMoveBackward,false,Enum.KeyCode.S)
ContextActionService:BindAction("MoveRight", handleMoveRight, false, Enum.KeyCode.D)
ContextActionService:BindAction("MoveLeft",handleMoveLeft,false,Enum.KeyCode.A)
ContextActionService:BindAction("JumpAction",handleJumpAction,false,Enum.KeyCode.Space)
end
- i have zero idea why this is happening lol