local Players = game:GetService("Players") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local camera = workspace.CurrentCamera local character, humanoid, rootPart, rootJoint local originalRootC0 = CFrame.new() local jumpOffset = 0 local jumpVelocity = 0 local function setupCharacter(char) character = char humanoid = char:WaitForChild("Humanoid") rootPart = char:WaitForChild("HumanoidRootPart") rootJoint = rootPart:FindFirstChild("RootJoint") or (char:FindFirstChild("LowerTorso") and char.LowerTorso:FindFirstChild("RootJoint")) if rootJoint then originalRootC0 = rootJoint.C0 end humanoid.StateChanged:Connect(function(_, newState) if newState == Enum.HumanoidStateType.Jumping then jumpVelocity = -0.15 elseif newState == Enum.HumanoidStateType.Landed then local fallSpeed = math.abs(rootPart.AssemblyLinearVelocity.Y) local impact = math.clamp(fallSpeed / 35, 0.15, 0.45) jumpVelocity = -impact end end) end if player.Character then setupCharacter(player.Character) end player.CharacterAdded:Connect(setupCharacter) local WALK_INTENSITY = 0.16 local WALK_FREQ = 10 local RUN_INTENSITY = 0.30 local RUN_FREQ = 14 local TILT_INTENSITY = 0.06 local LERP_SPEED = 0.18 local tickCounter = 0 local lastCameraRotation = camera.CFrame local currentCameraTilt = 0 local currentBobOffset = Vector3.new() local currentBodyTilt = Vector3.new() RunService.RenderStepped:Connect(function(deltaTime) if not humanoid or not rootPart or humanoid.Health <= 0 then return end local velocity = rootPart.AssemblyLinearVelocity * Vector3.new(1, 0, 1) local currentSpeed = velocity.Magnitude local isGrounded = humanoid.FloorMaterial ~= Enum.Material.Air if currentSpeed > 0.5 and isGrounded then local isRunning = currentSpeed > 18 local intensity = isRunning and RUN_INTENSITY or WALK_INTENSITY local freq = isRunning and RUN_FREQ or WALK_FREQ tickCounter += deltaTime * freq local bobX = math.cos(tickCounter * 0.5) * (intensity * 0.65) local bobY = math.abs(math.sin(tickCounter)) * intensity currentBobOffset = currentBobOffset:Lerp(Vector3.new(bobX, bobY, 0), LERP_SPEED) else tickCounter = 0 currentBobOffset = currentBobOffset:Lerp(Vector3.new(), LERP_SPEED) end local springStiffness = 180 local springDamping = 12 local force = -springStiffness * jumpOffset - springDamping * jumpVelocity jumpVelocity += force * deltaTime jumpOffset += jumpVelocity * deltaTime local deltaCFrame = camera.CFrame:ToObjectSpace(lastCameraRotation) local _, yawDelta = deltaCFrame:ToEulerAnglesYXZ() lastCameraRotation = camera.CFrame local targetCamTilt = math.clamp(yawDelta * 1.5, -TILT_INTENSITY, TILT_INTENSITY) currentCameraTilt = currentCameraTilt + (targetCamTilt - currentCameraTilt) * LERP_SPEED camera.CFrame = camera.CFrame * CFrame.new(currentBobOffset.X, currentBobOffset.Y + jumpOffset, 0) * CFrame.Angles(0, 0, currentCameraTilt) if rootJoint then local localVel = rootPart.CFrame:VectorToObjectSpace(velocity) local targetBodyX = -localVel.Z * 0.015 local targetBodyZ = localVel.X * 0.015 local targetBodyY = -yawDelta * 0.5 currentBodyTilt = currentBodyTilt:Lerp(Vector3.new(targetBodyX, targetBodyY, targetBodyZ), LERP_SPEED) local bodyBobY = (currentBobOffset.Y * 0.5) + (jumpOffset * 0.7) local bodyBobX = currentBobOffset.X * 0.3 rootJoint.C0 = originalRootC0 * CFrame.new(bodyBobX, bodyBobY, 0) * CFrame.Angles(currentBodyTilt.X, currentBodyTilt.Y, currentBodyTilt.Z) end end)