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

Help beginning and ending running animations?

Asked by 4 years ago

Hello,

Was curious how I could to make it so when I run, an animation plays and then the instant I stop running it stops? Currently, the method Im using just is working like I want to, any help would be greatly appreciated.

game:GetService("UserInputService").InputBegan:Connect(function (inputObj, gameProccessedEvent)
    if not gameProccessedEvent and Active == true then

        if inputObj.KeyCode == Enum.KeyCode.W then
            if IsHolstering == false then
                IsHolstering = true
                Holster:Play()
            else 
                IsHolstering = false
                Holster:Stop()
            end
        end
    end
end)

I just did the basic Key input but there has to be a better way,

Thank you!

1 answer

Log in to vote
0
Answered by 4 years ago
Humanoid.Running:Connect(function(Speed)
    if Active then
        if Speed > 0 then
            Holster:Play()
            IsHolstering = true
        elseif Speed <= 0 then
            IsHolstering = false
            Holster:Stop()
        end
    end
end)

Figured it out....I think?

Ad

Answer this question