local Y=Players.LocalPlayer local s=script.Parent local Z=s:WaitForChild("\072\117\109\097\110\111\105\100")local x=s.HumanoidRootPart local b=s.Torso local J=x.RootJoint local S=b["\076\101\102\116 \072\105\112"]local c=b["\082\105\103\104\116 \072\105\112"]local function O(Y,s,Z)return Y+(s-Y)*Z end local Q=nil local d=nil local p=0 local f=0 local L=J.C0 local E=S.C0 local m=c.C0 RunService.RenderStepped:Connect(function()Q=x.Velocity*Vector3.new(1,0,1)if Q.Magnitude>2 then d=Q.Unit p=x.CFrame.RightVector:Dot(d)f=x.CFrame.LookVector:Dot(d)else p=0 f=0 end J.C0=J.C0:Lerp(L*CFrame.Angles(math.rad(f*5),math.rad(-p*5),0),.2)end)

local Player = Players.LocalPlayer
local Character = script.Parent
local Humanoid = Character:WaitForChild"Humanoid"

local HumanoidRootPart = Character.HumanoidRootPart
local Torso = Character.Torso

local RootJoint = HumanoidRootPart.RootJoint
local LeftHipJoint = Torso["Left Hip"]
local RightHipJoint = Torso["Right Hip"]

local function Lerp(a, b, c)
	return a + (b - a) * c
end

local Force = nil
local Direction = nil
local Value1 = 0
local Value2 = 0

local RootJointC0 = RootJoint.C0
local LeftHipJointC0 = LeftHipJoint.C0
local RightHipJointC0 = RightHipJoint.C0

RunService.RenderStepped:Connect(function()
	--> To get the force, we multiply the velocity by 1,0,1, we don't want the Y value so we set y to 0
	Force = HumanoidRootPart.Velocity * Vector3.new(1,0,1)
	if Force.Magnitude > 2 then
		--> This represents the direction
		Direction = Force.Unit	
		Value1 = HumanoidRootPart.CFrame.RightVector:Dot(Direction)
		Value2 = HumanoidRootPart.CFrame.LookVector:Dot(Direction)
	else
		Value1 = 0
		Value2 = 0
	end

	--> the values being multiplied are how much you want to rotate by

	RootJoint.C0 = RootJoint.C0:Lerp(RootJointC0 * CFrame.Angles(math.rad(Value2 * 5), math.rad(-Value1 * 5), 0), 0.2)
end)
