Simple momentum based slope climbing script

a quick and easy implementation of momentum based slope climbing

How it works
the humanoid’s MaxSlopeAngle is scaled alongside WalkSpeed per tick when moving to accomplish the effect of being able to walk up steeper slopes based on your speed

Source code

local accelerateRate = 30
local decelerateRate = 500

local max = 50
local min = 5

local plr = game.Players.LocalPlayer
local chr = plr.Character or plr.CharacterAdded:Wait()

local rootpart = chr:WaitForChild("HumanoidRootPart")
local humanoid = chr:WaitForChild("Humanoid")

humanoid.MaxSlopeAngle = min
humanoid.WalkSpeed = min

local lastPosition = rootpart.Position
	if humanoid.MoveDirection ~= then
		humanoid.WalkSpeed += dt * accelerateRate
		humanoid.MaxSlopeAngle += dt * accelerateRate
		humanoid.WalkSpeed -= dt * decelerateRate
		humanoid.MaxSlopeAngle -= dt * decelerateRate

	lastPosition = rootpart.Position
	humanoid.WalkSpeed = math.clamp(humanoid.WalkSpeed, min, max)

bit of a basic post, but hopefulyl it helps someone


Cool this is what I’m using because I’m making a game with lots of mountains

1 Like

“The poor mans sonic physics system” and I will gladly use this because I have absolutely no idea on how to make a sonic physics system in roblox. I made something like this before this post was created (it does the pretty much the exact same thing but with fewer lines of code). It’s nice to see the exact same thing being made using different techniques

1 Like