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

Having a problem with animating the equipping of a gun.. Anyone know what's going wrong?

Asked by 7 years ago

Pretty much, I equip the gun, the animation plays and stays, but when I dequip the weapon, the animation still stays even though I've stopped it.

Tool = script.Parent
local player = game.Players.LocalPlayer
repeat wait() until player.Character ~= nil
local hum = player.Character:WaitForChild("Humanoid")
local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=511269087"
local animTrack = hum:LoadAnimation(animation) -- change Humanoid to the target's HumanoidanimTrack:Play()

Tool.Equipped:connect(function(mouse)



    animTrack:Play()


    animTrack.KeyframeReached:connect(function(Hold)
            animTrack:AdjustSpeed(0)
        end)
end)


Tool.UnEquipped:connect(function()
    animTrack:AdjustSpeed(1)
    animTrack:Stop()
end)

Video of the problem

1
Roblox is case sensitive. It should be Unequipped and not UnEquipped Thetacah 712 — 7y
0
God, I'm an idiot. Thanks a lot. VeryGoodPlayer 0 — 7y

Answer this question