Problem with Footlocking

Greetings everyone. I have been trying to code footlocking as shown in this video:

At the moment, I have this code

local Waist = c:WaitForChild("UpperTorso").Waist
local Root = c:WaitForChild("LowerTorso").Root
local WaistC,RootC = Waist.C0,Root.C0

local function SetLook()
	c:PivotTo(CFrame.new(c.PrimaryPart.Position, c.PrimaryPart.Position + (cam.CFrame.LookVector * Vector3.new(1,0,1))))
	
	Waist.C0 = WaistC * CFrame.Angles(cam.CFrame.LookVector.Y * 0.985,-cam.CFrame.LookVector.X,0)
	Root.C0 = RootC * CFrame.Angles(0,cam.CFrame.LookVector.X,0)
end

This code is not working due to the character awkwardly flipping whenever you turn more than 90° degrees

Thanks in advance.

1 Like