How do I detect if a player is on a slope that is on a specific angle?

Hi I’m currently trying to make a player ragdolls if it climbs a steep terrain but I do not know how to detect the current slope of the player.

The only way I know is just to adjust the max slope in starter player but I do not know how to make it connect a function.

1 Like

I’ll link you to this post

1 Like

Wait what’s the Raycast even for?

1 Like

shoots a raycast, and detects the normal of the part its hitting, thats why

1 Like

Hmmmm alright I might look it up tommorow and see what I can do.

I still have no idea and I’m prob just gonna remove the ragdoll

this can be done probably if im right (and im always right because im never wrong ever) using raycasts and some vector magic(that i could explain if you want me to but)

local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {character}
--prob put this in a loop yk
if not ragdolled and onground then
	local results = workspace:Raycast(humanoidRootPart.Position,-Vector3.yAxis*5--[[ray length below the player]],params)
	if results then
		local angle = math.deg(math.acos(Vector3.yAxis:Dot(results.Normal)))--in degrees
	end
end

the only things that i think could be improved is the distance to cast below the player(but it doesnt matter if you check if they are on the ground anyways)

2 Likes

Thanks but I think I’m gonna go another way.