How do I make the player tilt

Hello, I’m trying to make the player tilt whilst in first person running, I’ve found a solution for it out of 3rd person but how would I make it so its tilting in FIRST person.

1 Like

Can you elaborate further on what you mean by “Tilt”?

Oh yes, my fault I had a video ready but forgot to put it up.

1 Like

check the X direction the player is going and set the camera Z angle to it

LocalScript, StarterCharacterScripts:

local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")

local Humanoid = script.Parent:WaitForChild("Humanoid", math.huge)
local Camera = workspace.CurrentCamera

local Z = Instance.new("NumberValue") -- because using tweenservice on camera.CFrame is buggy
local Direction = 0
local CurrentTween = nil

-- change these 2 variables
local Smoothness = 0.2
local TiltLevel = 0.025

RunService.RenderStepped:Connect(function()
	local ZDirection = -math.round(Humanoid.MoveDirection:Dot(Camera.CFrame.RightVector))
	
	if ZDirection ~= Direction and CurrentTween then
		CurrentTween:Pause()
		CurrentTween:Destroy()
		CurrentTween = nil
	end
	
	if not CurrentTween then
		Direction = ZDirection
		
		CurrentTween = TweenService:Create(
			Z,
			TweenInfo.new(Smoothness),
			{["Value"] = ZDirection * TiltLevel}
		)

		CurrentTween:Play()
	end
	
	Camera.CFrame = Camera.CFrame * CFrame.Angles(0, 0, Z.Value) -- you can use math.rad here
end)

exactly what i was looking for thanks!

question, how would I make the camera sway?