Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tool animation plays on mouseclick, stops at a certain point, continues after mouse release?

Asked by 5 years ago

Here's the current code. (localscript in tool)

local Tool = script.Parent

local shortstab = Tool.ShortStab


Tool.Equipped:Connect(function(Mouse)

    local character = Tool.Parent

    local hum = character.Humanoid

    local lightstab = hum:LoadAnimation(Tool.ShortStab)

    Mouse.Button1Down:Connect(function()

        print("Button1Down")

        lightstab:Play()

        wait(0.2)

        lightstab:AdjustSpeed(0)

        Mouse.Button1Up:Connect(function()

        print("Button1Up")

        lightstab:AdjustSpeed(1)

    end)

    end)

end)

This works when I click and hold for a bit and then release, but if I just click and release immediately (you know, a normal click) it gets stuck in the 0 speed position. How do I allow both clicking and clicking and holding? (If you've ever played blood and iron, you'll get what I'm talking about.)

0
Why the AdjustSpeed0 ? A value of 0 is a pause, is that what you are wanting? ABK2017 406 — 5y
0
Yeah, a pause. I didn't know there was a simpler way. Does that make what I'm going for easier? LoadOfToads 10 — 5y

Answer this question