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

Animation of the tool does not stops when i unequip the tool, can someone help ?

Asked by 3 years ago

Hello, i made a gun with an idle anim, but when i unequip the tool the animation doesn't stops to play, can someone help me with this ?

repeat wait() until game.Players.LocalPlayer
local player = script.Parent.Parent.Parent
local mouse = player:GetMouse()
local Enabled = true

script.Parent.Equipped:connect(function()

  mouse.KeyDown:connect(function(key)

        if key == "e" and Enabled == true then
        local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
        idle:Play()
        Enabled = false

    elseif key == "e" and Enabled == false then
        local aim = script.Parent.Parent.Humanoid:LoadAnimation(script.Aim)
        aim:Play()
        Enabled = true

        end


    end)

end)

script.Parent.Unequipped:connect(function()
    local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
    local aim = script.Parent.Parent.Humanoid:LoadAnimation(script.Aim)

    idle:Stop()
    aim:Stop()

end)
0
hello ? solune_arthur 0 — 3y

Answer this question