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
game:GetService("RunService").Heartbeat:Connect(function(dt)
if humanoid.MoveDirection ~= Vector3.new() then
humanoid.WalkSpeed += dt * accelerateRate
humanoid.MaxSlopeAngle += dt * accelerateRate
else
humanoid.WalkSpeed -= dt * decelerateRate
humanoid.MaxSlopeAngle -= dt * decelerateRate
end
lastPosition = rootpart.Position
humanoid.WalkSpeed = math.clamp(humanoid.WalkSpeed, min, max)
end)
bit of a basic post, but hopefulyl it helps someone