--== OK DEVON MAKE THIS ==--


local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local TS = game:GetService("TweenService")

local Player = Players.LocalPlayer
local Character = script.Parent

local Humanoid = Character:FindFirstChildOfClass("Humanoid")

local camera = workspace.Camera

repeat wait() until Humanoid

local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Torso = Character:WaitForChild("Torso")

local RootJoint = HumanoidRootPart:WaitForChild("RootJoint")

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


RunService.RenderStepped:Connect(function()
	Force = HumanoidRootPart.Velocity * Vector3.new(0.2, 0, 0.2)

	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 * 8), math.rad(-Value1 * 7), 0), 0.2)
end)
