How do I prevent character sliding on part in the humanoid state of "Climbing"

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Stop the character from sliding down when in the state of climbing

  2. What is the issue? Include screenshots / videos if possible!
    Character sliding down

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried to anchor the character when they stop moving, like you know. the character gets stuck even if ur trying to move. I also tried to check off the evaluatedstatemachine. The character is climbing, but yet still slide down.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

if ray and ray.Instance and ray.Instance.Parent.Name == "Walls" and Stamina.Value > 0 then
		if Climbing == false then
			Climbing = not Climbing
			BodyGyro = Instance.new("BodyGyro")
			BodyGyro.P = 1000
			BodyGyro.D = 100
			BodyGyro.MaxTorque = Vector3.new(math.huge, 0, math.huge)
			BodyGyro.Parent = Character.HumanoidRootPart
			Humanoid.AutoRotate = false
		end
		
		local Direction = math.round(Humanoid.MoveDirection:Dot(Character.HumanoidRootPart.CFrame.LookVector))
		local Direction2 =  math.round(Humanoid.MoveDirection:Dot(Character.HumanoidRootPart.CFrame.RightVector))
		Character.HumanoidRootPart.Velocity = Vector3.new(0, Direction * 10, 0)
		BodyGyro.CFrame = CFrame.new(Character.HumanoidRootPart.Position, ray.Position)
		
		if Humanoid:GetState() ~= Enum.HumanoidStateType.Climbing then
			Humanoid:ChangeState(Enum.HumanoidStateType.Climbing)
		end
		
		if ray.Position.Y > ray.Instance.Position.Y *1.8 then
			Character.HumanoidRootPart.Velocity = Vector3.new(0, Direction * 20, 0)
		end
	else
		if Climbing == true then
			Climbing = not Climbing
			if BodyGyro then
				BodyGyro:Destroy()
				Humanoid.AutoRotate = true
			end
		end
	end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.