Hello!

I would like to know how to make my script detect if the player is sliding off of a wall.

By this i mean:

I made a wall ledge climbing sort of thing, and i enhanced it to be able to move sideways but i need to know how to see if the player is going to float off of a wall, i am still trying to find a solution for this.

You move sideways by the positioning of the character's HumanoidRootPart.Position + HumanoidRootPart.CFrame.RightVector * 1, for example.

I think i would have to use something like math.clamp or raycasting, but i don't know a strategy of how to use it.

Anyways, here is my code:

local function startMoveRight()
		if not isMovingSideways then
			isMovingSideways = true
			while isMovingSideways do
				root.Position = root.Position + root.CFrame.RightVector * 0.1
				wait()
			end
		end
	end
	
	local function startMoveLeft()
		if not isMovingSideways then
			isMovingSideways = true
			while isMovingSideways do
				root.Position = root.Position + root.CFrame.RightVector * -0.1
				wait()
			end
		end
	end

After those lines of code i bind them with UserInputService.InputBegan() and InputEnded().

If you could help then that would be most appreciated!