Issues with slide mechanic

  1. What do you want to achieve? Keep it simple and clear!
    I am trying to create a sliding ability.

  2. What is the issue? Include screenshots / videos if possible!
    Making the slide impulse lower just stops the character, but making it higher makes it too fast. I think I should just remake it.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried searching for multiple hours, yet most of the results were old and used deprecated instances.

if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) and not self.SlideCooldown and not self.IsSliding then
		self.IsSliding = true
		local rootPart = character:WaitForChild("HumanoidRootPart")

		local oldSpeed = humanoid.WalkSpeed
		humanoid.WalkSpeed = 0

		if not rootPart:FindFirstChild("SlideAttachment") then
			local slideAttachment = Instance.new("Attachment")
			slideAttachment.Name = "SlideAttachment"
			slideAttachment.Parent = rootPart
		end
		local slideAttachment = rootPart.SlideAttachment

		slideVelocity = Instance.new("LinearVelocity")
		slideVelocity.MaxForce = 10000
		slideVelocity.Attachment0 = slideAttachment
		slideVelocity.VectorVelocity = Vector3.new(0,0,0)
		slideVelocity.Parent = rootPart

		setHasFriction(false)

		local slideStep = 0

		while (self.IsSliding and slideStep < self.Physics.SlideImpulse) do
			slideStep += 2
			local goalVector = rootPart.CFrame.LookVector * (self.Physics.SlideImpulse - slideStep)
			slideVelocity.VectorVelocity = (Vector3.new(goalVector.X, 0, goalVector.Z) + self.Physics.SlideGravity) * (self.Physics.SlideImpulse - slideStep)
			task.wait()
		end
		self.SlideCooldown = true
		slideVelocity:Destroy()
		humanoid.WalkSpeed = oldSpeed
		self.IsSliding = false

		setHasFriction(true)
				
		task.wait(self.SlideCooldownTime)
		self.SlideCooldown = false
	end
elseif inputState == Enum.UserInputState.End then
	if slideVelocity then slideVelocity:Destroy() end
	self.IsSliding = false
end

I would like help in order to find a better way of doing it

How do I make a
Sliding script that changes speed down a slope or does the script you have impliment that