Sliding Physics

I need a way to check if the current thing that a player is walking on is at a slant so that depending on how angled the slant is the faster the player can go.
(If you don’t know what I am trying to say just think of the sliding system from apex legends)

You can just use body velocity when +2 keybind or 1

You should be able to get the angle to ground by raycasting downwards and using the Normal property in a formula like:

local angle = math.atan2(normal.Y, normal:Dot(humanoidRootPart.CFrame.LookVector))

How would I make a raycast downwards?

Given the orgin point of the ray you would just want to set the, Direction value to the LookVector of your given object (- Vector):

local DownVector = Object.CFrame.LookVector * -10 -- Goes 10 studs down from the object's inital position (This would be the direction value of the ray)

Would this just be trying to find which way the character is moving or making it look for the ground?

Just raycast with a direction of like (0,-5,0)

should I make it its own function or stick to the sliding function?

Whatever makes the most sense for your script

do you think you can give a little example of what it could look like? I’m still having a bit of a hard time understanding how I’m meant to make it check for the angle.

Something like

local param =
param.FilterType = Enum.RaycastFilterType.Blacklist
param.FilterDescendantsInstances = {character}
local res = workspace:Raycast(hrp.Position,,-3,0),param)
if res then
    local normal = res.Normal
    local angle = math.atan2(normal.Y, normal:Dot(humanoidRootPart.CFrame.LookVector))

In a loop

I my best to try to put things all together but all it does it make my character move forwards as long as you hold c, I’m not quite sure how I can make it so it make the character go fast at first then change the slide speed depending on the angled surface

function startSlide()
	local goal = { }
	local param =
	param.FilterType = Enum.RaycastFilterType.Blacklist
	param.FilterDescendantsInstances = {char}
	local res = workspace:Raycast(hrp.Position,, -3.25, 0),param)
	local angle = nil
	sDirection = hrp.CFrame.LookVector
	sSpeed = math.max(25,, 0, hrp.Velocity.Z).Magnitude) + 20
	vel ="BodyVelocity")
	gyro ="BodyGyro")
	if res then
		angle = math.acos(, 1, 0):Dot(res.Normal))
	if hum.MoveDirection ~=, 0, 0) then
		sDirection = sDirection:Lerp(hum.MoveDirection, 0.05)
	vel.Velocity = sDirection * math.min(sSpeed, 150)
	vel.MaxForce =, 0, 100000)
	vel.Parent = hrp
	gyro.CFrame = CFrame.lookAt(hrp.Position, hrp.Position + sDirection)
	gyro.MaxTorque =, 100000, 0)
	gyro.Parent = hrp
	hum.AutoRotate = false
	goal.CameraOffset =, -.7, 0)
	if sSpeed <= 14 or hrp.Velocity.Magnitude <= 5 then
	local st = ts:Create(hum, slideTI, goal)