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

How do I call the animation in this script into use?

Asked by 9 years ago

It's a gun script. I need the reload animation to play when I press "r".

function reload(mouse)
    reloading=true
    mouse.Icon=ReloadCursor
    while sp.Ammo.Value<ClipSize and reloading and enabled do
        wait(ReloadTime/ClipSize)
        if reloading then
            sp.Ammo.Value=sp.Ammo.Value+1
            check()
        else
            break
        end
    end
    check()
    mouse.Icon=Cursors[1]
    reloading=false
end

function onKeyDown(key,mouse)
    key=key:lower()
    if key=="r" and not reloading then
        reload(mouse)
        sp.Handle.Reload:Play()
        local animation = Instance.new("Animation")
        animation.AnimationId = "http://www.roblox.com/Asset?ID=236490010" -- your id here

        local animTrack = sp.Parent.Humanoid:LoadAnimation(animation) -- chanhe Humanoid to the target's Humanoid
        animTrack:Play()


    end
end

0
I think you need a tuple in the :Play(--[[tuple here]]) function (to define speed of animation and such) FutureWebsiteOwner 270 — 9y

Answer this question