I am currently trying to create a cross-platform sprint button. To achieve this, I am using ContextActionService to bind several inputs to the same function.
function handleAction(actionName, inputState, inputObject)
if actionName == "Sprint" then
if inputState == Enum.UserInputState.Begin then
--begin sprinting
else
--stop sprinting
end
end
end
ContextActionService:BindAction("Sprint", handleAction, true, ControlsList.keyboard.Sprint, ControlsList.gamepad.Sprint)
This works well with keyboard and gamepad, but this does not work well with the mobile button that is created. The mobile button fires this function on press (InputBegin) but not on release (there is no InputEnded). The thing is, I absolutely need the release to fire. Is there a way to receive cross-platform inputs more effectively?