local V=Players.LocalPlayer local L=script.Parent local B=L:WaitForChild("\072\117\109\097\110\111\105\100")local U=L.HumanoidRootPart local A=L.Torso local m=U.RootJoint local X=A["\076\101\102\116 \072\105\112"]local d=A["\082\105\103\104\116 \072\105\112"]local function i(V,L,B)return V+(L-V)*B end local f=nil local Z=nil local h=0 local g=0 local q=m.C0 local Y=X.C0 local I=d.C0 RunService.RenderStepped:Connect(function()f=U.Velocity*Vector3.new(1,0,1)if f.Magnitude>2 then Z=f.Unit h=U.CFrame.RightVector:Dot(Z)g=U.CFrame.LookVector:Dot(Z)else h=0 g=0 end m.C0=m.C0:Lerp(q*CFrame.Angles(math.rad(g*7),math.rad(-h*7),0),.2)X.C0=X.C0:Lerp(Y*CFrame.Angles(math.rad(-h*7),0,0),.2)d.C0=d.C0:Lerp(I*CFrame.Angles(math.rad(h*7),0,0),.2)end)
--|| VARIABLES ||--
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()
	Force = HumanoidRootPart.Velocity * Vector3.new(1, 0, 1)
	if Force.Magnitude > 2 then
		Direction = Force.Unit
		Value1 = HumanoidRootPart.CFrame.RightVector:Dot(Direction)
		Value2 = HumanoidRootPart.CFrame.LookVector:Dot(Direction)
	else
		Value1 = 0
		Value2 = 0
	end

	RootJoint.C0 = RootJoint.C0:Lerp(RootJointC0 * CFrame.Angles(math.rad(Value2 * 7), math.rad(-Value1 * 7), 0), 0.2)
	LeftHipJoint.C0 = LeftHipJoint.C0:Lerp(LeftHipJointC0 * CFrame.Angles(math.rad(-Value1 * 7), 0, 0), 0.2)
	RightHipJoint.C0 = RightHipJoint.C0:Lerp(RightHipJointC0 * CFrame.Angles(math.rad(Value1 * 7), 0, 0), 0.2)
end)
