Cross-Platform Inputs

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
			--stop sprinting

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?

You could simply add another inputstate that uses the input ended instead.

1 Like

Turns out my client would not register input ended events. I tried it on another device and it worked flawlessly. Thanks!

1 Like