#When I press backspace, suddenly I can't slide anymore.

21 messages · Page 1 of 1 (latest)

untold zinc
#

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)
harsh jetty
#

i am sorry i cant help that but can you help me

#

my animation doesnt work

#

and i really need help

untold zinc
harsh jetty
# untold zinc u loaded the animation?

local canDamage = false
local damageDistance = 5 -- the maximum distance for the tool to damage

local swingAnimationId = "rbxassetid://14964665748"
local swingAnimation = Instance.new("Animation")
swingAnimation.AnimationId = swingAnimationId

local function onTouch(otherPart)
    local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
    if not humanoid then 
        return 
    end

    if humanoid.Parent == tool.Parent or not canDamage then 
        return
    end

    local distance = (otherPart.Position - tool.Handle.Position).Magnitude
    if distance > damageDistance then
        return
    end

    humanoid:TakeDamage(20)
    canDamage = false
end

local function slash()
    local humanoid = script.Parent.Parent:FindFirstChild("Humanoid")
    if humanoid then
        local animTrack = humanoid:LoadAnimation(swingAnimation)
        animTrack:Play()
        canDamage = true
    end
end

    
tool.Activated:Connect(slash)
tool.Handle.Touched:Connect(onTouch)
#

my script

#

its meant to deal damage and animate the swing at left click

#

but it doesnt work

untold zinc
#

thats what i do if i need help

harsh jetty
lilac gate
#

@untold zinc

#

You are setting the variable one more time

#

That's the problem

#

Also you're never setting it back to false

#

On backspace event

untold zinc
#

bc when i try using a different variable pressing backspace does nothing