How can I make the CurrentCamera tilt on the Z axis?

I want to Tilt the camera on the Z axis when a player is sprinting next to a wall. Instead the camera just breaks and dosent let me move at all.Ive looked at a couple solutions in dev hub and i have been trying then but they dont seem to work for me.

local function Test()
		local X, Y, Z  = Camera.CFrame:ToOrientation()
		print(math.round(math.deg(X)), math.round(math.deg(Y)), math.round(math.deg(Z)))
		Camera.CFrame = CFrame.new(Camera.CFrame.Position) * 
                CFrame.fromOrientation(math.rad(X), math.rad(Y), math.rad(20))
end
	
RunService:BindToRenderStep("Testingg", Enum.RenderPriority.Camera.Value + 1, Test)

This is what i have been trying right now, BindToRenderStepped seems to be the only event? that works as Stepped, Heartbeat, RenderStepped prolly need camera to be set to scriptable

3 Likes