How to Make a Player Stop When They Hit a Wall

Hey all, I’m trying to figure out how I can get the player to stop sliding when they hit a wall. I.e., stopping the animation and stopping the body velocity.
Here’s what it does now.
This works fine, but I just want it to immediately stop as soon as it hits the wall/part.
I have tried looking for solutions on the DevForum and other websites, but this type of problem I just seem to not be able to find much of anything on.

Here is the code:

canSlide = false
				local SlideVelocity ="BodyVelocity")
				SlideVelocity.MaxForce =, 0, 1) * 20000
				SlideVelocity.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 100
				SlideVelocity.Parent = Character.HumanoidRootPart
				for count = 1, 8 do
					SlideVelocity.Velocity *= 0.9
				canSlide = true

Please let me know if further elaboration is needed.
Thanks in advance.

You can check HRP Velocity and if it changes to a low number you can stop the animation.

Thanks for your help, but what is the syntax for using this?
For example,

if Character.HumanoidRootPart.Velocity == ___ then

what would I replace the ___ with?, or a number value?

My bad forgot to mention, you can use Velocity.Magnitude, it returns every coordinate value combined.

if Character.HumanoidRootPart.Velocity.Magnitude >= MinVelocity then

Great, thank you so much for your help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.