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. https://gyazo.com/688afaf693dfc1cb703f1d39eabbce62
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
				SlideTrack:Play()
				local SlideVelocity = Instance.new("BodyVelocity")
				SlideVelocity.MaxForce = Vector3.new(1, 0, 1) * 20000
				SlideVelocity.Velocity = Character.HumanoidRootPart.CFrame.lookVector * 100
				SlideVelocity.Parent = Character.HumanoidRootPart
				for count = 1, 8 do
					wait(0.05)
					SlideVelocity.Velocity *= 0.9
				end
				SlideTrack:Stop()
				SlideVelocity:Destroy()
				wait(2.25)
				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
	
end

what would I replace the ___ with? Vector3.new(), or a number value?

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

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

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.