Can't rotate RootJoint of Character on the Z axis?

Hi! :wave:

I’m currently working on a tilting system where the player tilts in the direction they are moving. I’m changing the orientation of the RootJoint in the HumanoidRootPart to do this.

The issue I’ve encountered is I can’t rotate the RootJoint on the Z axis! Below is a video of this issue:

Here is my current code:

-- SERVICES
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

-- CONSTANTS
local Player = Players.LocalPlayer
local Configuration = ReplicatedStorage.MeleeCombatConfiguration

local TiltAngle = Configuration.TiltAngle.Value -- The amount in degrees the player should tilt when moving

-- VARIABLES
local character
local runningConnection
local runningDirection = nil
local goalTilt = 0
local currentTilt = 0


-- METHODS
-- A mathematical function that takes two numbers as input and returns a number half way between
local function Lerp(a, b, c)
	return a + (b - a) * c
end

-- A procedure used to tilt the player's character when they are walking
local function Running(speed)
	if speed > 2 then
		runningDirection = character.HumanoidRootPart.CFrame:vectorToObjectSpace(character.Humanoid.MoveDirection).Unit
		goalTilt = TiltAngle
	elseif speed <= 2 and runningDirection ~= nil then
		goalTilt = 0
	end	
end

-- A procedure that runs each frame
local function RenderStepped(deltaTime)
	if character and runningDirection then
		currentTilt = math.clamp(Lerp(currentTilt, goalTilt, 1 - 0.5 ^ (deltaTime * 10)), 0, TiltAngle)
		character.HumanoidRootPart.RootJoint.C0 = CFrame.fromOrientation(math.rad(currentTilt * -runningDirection.Z - 90), math.rad(currentTilt * -runningDirection.X -180), 0)
	end
end


-- EVENTS
RunService.RenderStepped:Connect(RenderStepped)

Is there a work around to this? Or is there a property I need to change somewhere? Any help would be much appreciated!