Hi! I'm making a game where you are a ball that can move and I'm trying to make it mobile compatiable. I'm kinda making a "d-pad" from the buttons... I'm using ContextActionService because I've heard that is the best way to make buttons for mobile, but there is a "bug" (It's probably not...) where if you hold down a button, move your finger away from the button and release, it will still move. Here's the code!
local A
function aPressed(actionName, userInputState, inputObject)
if userInputState == Enum.UserInputState.Begin then
A = true
elseif userInputState == Enum.UserInputState.End then
A = false
end
end
game.ContextActionService:BindAction("keyPressA", aPressed, true, Enum.KeyCode.A)
game.ContextActionService:SetPosition("keyPressA", UDim2.new(-2, 0, 0.3, 0))
Which combination of buttons you press, will go through a "RunService" and change the players velocity.
