Decreasing speed when doing sliding animation

Basically I have a script that makes the character play a slide animation when you press a key, but now I want to know how to decrease the player speed so It doesn’t keep moving infinitely while crouching:

You could use tween service and tween the walkspeed down so that they slow down the more they slide. Or you could use a for loop to bring it down as well. Just something like that could be implemented in your script(if I’m understanding everything and you want something like that)

local Info = TweenInfo.new(2.1)
local Tween = game:GetService("TweenService"):Create(player.Character.Humanoid, Info, {WalkSpeed = 0})
Tween:Play()

3 Likes

I found a better way to decrease the speed by changing the Character’s PhysicalProperties, decreasing the default Density and increasing the FrictionWeight, but thanks for the response.

local Hrp = Player.Character.HumanoidRootPart

if (Sliding) then
	Hrp.CustomPhysicalProperties =PhysicalProperties.new(.15, .3, 0, 100, 100);
elseif (not Sliding) then
	Hrp.CustomPhysicalProperties = PhysicalProperties.new(.8, .3, 0, 10, 100);
end