Context Action buttons lock camera

So I was fiddling around with trying to make my FPS game playable for mobile players and I noticed that when pressing a context button, your camera get’s frozen. Like it cannot move. I want people to be able to hold and drag the button that way they can look around and shoot at the same time. Does anyone know how to make this possible?

1 Like

Perhaps you should add:


return Enum.ContextActionResult.Pass

At the end of your CAS function, what this does is it tells the code that CAS should not steal the keybind for itself, (eg so that other programs can’t use it, such as camera).

Sorry I don’t understand. I have the context action binded to a function. do I put it there?

Haha sorry I should of explained it a little better, (I’m on mobile so excuse the formatting).

local function actionHandlerTwo(actionName, inputState, inputObj)
	if inputState == Enum.UserInputState.Begin then 
		print("Action Handler Two: " .. actionName)
	end
	
	if inputObj.KeyCode == Enum.KeyCode.X then
		return Enum.ContextActionResult.Pass
	else
		-- Returning nil implicitly Sinks inputs
		return Enum.ContextActionResult.Sink
	end
end

Here is a code snippet from the dev hub, as you can see the return Pass or Sink is at the end of the function

This didn’t seem to work…

function RequestShoot(Name,InputState,Object)
	
	if InputState == Enum.UserInputState.Begin then
		ShootStart()
	elseif InputState == Enum.UserInputState.End then
		ShootEnd()
	end
	
	return Enum.ContextActionResult.Sink
end

Should I just resort to using regular buttons???

You are using the wrong one, I said to use

this one