How to make FPS Game Arm?

Ok so, you will need to add a LocalScript into StarterPlayerScripts and here is the code. This is compatible for mobile and computer:

local UserInputService = game:GetService("UserInputService")
local ContextActionService = game:GetService("ContextActionService")
local Players = game:GetService("Players")

local Camera = workspace.CurrentCamera

local Player = Players.LocalPlayer

local function CameraControl(ActionName, InputState, InputObject)
	if InputState == Enum.UserInputState.Begin then
		Player.CameraMode = Enum.CameraMode.LockFirstPerson
		
		UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
		
		ContextActionService:UnbindAction("CameraControl")
	end
end

ContextActionService:BindAction("CameraControl", CameraControl, false, Enum.UserInputType.MouseMovement, Enum.UserInputType.Touch)
3 Likes