What I want to achieve is something similar to ultrakill, where if you press backspace, you lose your momentum, but can still slide. However when I do that on my script, it makes me lose the ability to slide. IDK how to fix it
Here's the script btw for the sliding and backspace mechanic:
local slideAnim = Instance.new("Animation")
slideAnim.AnimationId = "rbxassetid://14964117242"
local debounce = false
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftControl then
if debounce == false then
local SldAnimationPlay = Character.Humanoid:LoadAnimation(slideAnim)
SldAnimationPlay:Play()
local Velocity = Instance.new("BodyVelocity")
Velocity.MaxForce = Vector3.new(1,0,0)*50000
Velocity.Velocity = Character.HumanoidRootPart.CFrame.lookVector*100
Velocity.Parent = Character.HumanoidRootPart
wait(1)
SldAnimationPlay:Stop()
Velocity:Destroy()
wait(1)
local debounce = true
end
end
if input.KeyCode == Enum.KeyCode.Backspace then
if debounce == false then
local Velocity = Instance.new("BodyVelocity")
Velocity.Velocity = Vector3.new(0,0,0)
Velocity.Parent = Character.HumanoidRootPart
local debounce = true
end
end
end)