Help making a 'smooth' sliding system

Hi! I just finished following a tutorial for a sliding system but it doesn’t feel right. It uses a BodyVelocity to move the player but it doesn’t feel polished enough. I’m trying to mimic the sliding system in the game ‘Rivals’. I want to make it so that when the player jumps mid-slide they are boosted upwards a bit and play an animation, and I also want to make it so that when a player is sliding down a slope their slide lasts until they reach the bottom rather than it stopping the slide in the same amount of time regardless. The player does this weird jump when sliding down a ramp, and it doesn’t feel nice like other games.

local UIS = game:GetService("UserInputService")
local ss = game:GetService("SoundService")

local slideSound = ss:WaitForChild("Slide")

local char = script.Parent
local player = game.Players.LocalPlayer

local slideAnim = Instance.new("Animation")
slideAnim.AnimationId = "rbxassetid://18861902913"

local key = Enum.KeyCode.LeftControl
local canSlide = true

UIS.InputBegan:Connect(function(input, gameprocessed)
	if gameprocessed then return end
	if not canSlide then return end
	
	if input.KeyCode == key then
		slideSound:Play()
		canSlide = false
		local playAnim = char.Humanoid:LoadAnimation(slideAnim)
		playAnim:Play()
		
		local slide = Instance.new("BodyVelocity")
		slide.MaxForce = Vector3.new(1,0,1) * 30000
		slide.Velocity = char.HumanoidRootPart.CFrame.lookVector * 100
		slide.Parent = char.HumanoidRootPart
		
		for count = 1, 8 do
			task.wait(0.1)
			slide.Velocity *= 0.7
		end
		playAnim:Stop()
		slideSound:Stop()
		slide:Destroy()
		canSlide = true
	end
end)

I was just wondering if anyone can help me by pointing me in the right direction or perhaps amending the code.

2 Likes