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.