torso=character:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")joint=character:FindFirstChild("\082\111\111\116\074\111\105\110\116",true)baseC1=joint.C1 cr=coroutine.resume cc=coroutine.create local function B()local B=torso.CFrame.RightVector:Dot(humanoid.MoveDirection)local i=torso.CFrame.LookVector:Dot(humanoid.MoveDirection)if frontenabled then return B,i*frontmultiplier else return B,0 end end humanoid.Died:connect(function()script.Disabled=true end);(game:GetService("\082\117\110\083\101\114\118\105\099\101")).Heartbeat:Connect(function()local i,e=B()joint.C1=joint.C1:Lerp(baseC1*CFrame.Angles(math.rad((-e*maxtilt)*(humanoid.WalkSpeed/8)),0,math.rad((i*maxtilt)*(humanoid.WalkSpeed/16))),stiffness/50)local u=tick()if humanoid.MoveDirection.Magnitude>0 then cr(cc(function()local B=math.cos(u*7.5)*.25 local i=math.abs(math.sin(u*7.5))*.25 local e=Vector3.new(B,i,0)humanoid.CameraOffset=humanoid.CameraOffset:lerp(e,.25)end))else humanoid.CameraOffset=humanoid.CameraOffset*.75 end end)
--// MAIN CODE

torso = character:WaitForChild("HumanoidRootPart")
joint = character:FindFirstChild("RootJoint", true)
baseC1 = joint.C1

cr = coroutine.resume
cc = coroutine.create

local function getangles()
	local side = torso.CFrame.RightVector:Dot(humanoid.MoveDirection)
	local front = torso.CFrame.LookVector:Dot(humanoid.MoveDirection)
	if frontenabled then
		return side, front * frontmultiplier
	else
		return side, 0
	end
end

humanoid.Died:connect(function()
	script.Disabled = true
end)

game:GetService("RunService").Heartbeat:Connect(function()
	local side, front = getangles()
	joint.C1 = joint.C1:Lerp(
		baseC1
			* CFrame.Angles(
				math.rad(-front * maxtilt * (humanoid.WalkSpeed / 8)),
				0,
				math.rad(side * maxtilt * (humanoid.WalkSpeed / 16))
			),
		stiffness / 50
	)

	local ctick = tick()
	if humanoid.MoveDirection.Magnitude > 0 then
		cr(cc(function()
			local bobx = math.cos(ctick * 7.5) * 0.25
			local boby = math.abs(math.sin(ctick * 7.5)) * 0.25

			local bob = Vector3.new(bobx, boby, 0)

			humanoid.CameraOffset = humanoid.CameraOffset:lerp(bob, 0.25)
		end))
	else
		humanoid.CameraOffset = humanoid.CameraOffset * 0.75
	end
end)
