How to replicate player movement tilt script from R6 to R15

Hello! I am trying to adapt the script provided in this forum post about tilting the player in the direction of movement here How would you tilt the character in the direction you walk in? from R6 to R15. R15 doesn’t have Motor6Ds at the hips on the torso part like R6 does so the script from the link seems to turn the player rather than tilt them. I’ve recorded a GIF of the problem below.

I have tried using the left and right hip joint Motor6Ds from the legs however they end up only affecting the legs due to what I assume is parent-child tomfoolery or possibly user error.

Here is my bashed together code below. Any help or insight would be much appreciated.

local plr = game.Players.LocalPlayer
local FuncLib = game.ReplicatedStorage:WaitForChild("FuncLib")
local RunService = game:GetService("RunService")

local Character = plr.Character or plr.CharacterAdded:Wait()
local HumRP = Character.HumanoidRootPart

local RootJoint = Character.LowerTorso.Root

local Force = nil
local Direction = nil
local V1 = 0
local V2 = 0

local RootJointC0 = RootJoint.C0

--RUNSERVICE FUNCTION

RunService.RenderStepped:Connect(function()

	Force = HumRP.Velocity * Vector3.new(1,0,1)
	if Force.Magnitude > 2 then

		Direction = Force.Unit
		V1 = HumRP.CFrame.RightVector:Dot(Direction)
		V2 = HumRP.CFrame.LookVector:Dot(Direction)
	else
		V1 = 0
		V2 = 0
	end

	RootJoint.C0 = RootJoint.C0:Lerp(RootJointC0 * CFrame.Angles(math.rad(-V2 * 30), math.rad(-V1 * 30), 0), 0.2)

end)

Please excuse for any poor formatting, this is my first post on the dev forum.

1 Like

Shouldn’t the tilt be in the Z axis and not the Y axis like the previous post?

CFrame.Angles(math.rad(-V2 * 30), 0, math.rad(-V1 * 30)), 0.2)

Yeah that was it, thanks. I hadn’t slept until just a bit ago so I probably should’ve done a bit more testing before making an actual post lol. Appreciate it boss!