First of all I want to detect when the player moves forward or backward with Context Action Service. The problem is that I can’t assign a keybind to W/S because the player stops moving.
The code I have written so far:
local CAS = game:GetService("ContextActionService")
local MoveForward = false
CAS:("Forward", handleAction, false, Enum.KeyCode.W)
if actionName == 'Forward' then
MoveForward = true
else
MoveForward = false
end
I need it for a run script. I tried UIS too but isn’t working because i use CAS for detecting if player is pressing left shift and only updates when i press any key binded to CAS. With this i want to prevent the player running backwards and side to side.