Just wondering about proper methodologies for accomplishing keybinding for any platform, I have sample code that I havent fully tested but from delving into forum posts this seems to be the answer
One thing that seems ambiguous is determining what platform localplayer is currently on
--for console and pc
ContextActionService:BindAction("CheckActiveWASD", CheckActiveWASD, false,
Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D, Enum.KeyCode.Thumbstick1)
--Mobile
game.RunService.Stepped:Connect(function()
if humanoid.MoveDirection.X > 0 then
--D
elseif humanoid.MoveDirection.X < 0 then
--A
end
if humanoid.MoveDirection.Z > 0 then
--W
elseif humanoid.MoveDirection.Z < 0 then
--S
end
end)
I don’t know why but this sort of thing seems ambiguous, mysterious, unknown and different solutions seem to exist??? from what i’ve read, thumbstick1 doesnt work for mobile so a user suggested to use the vector from humanoid
this seems to be a better method for mobile
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local ControlModule = require(LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"):WaitForChild("ControlModule"))
while true do
task.wait()
local currentDirection = ControlModule:GetMoveVector()
print(currentDirection)
end