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

How Do You Make The Animation Play On The Player?

Asked by 8 years ago

How Do You Make The Animation Play? Note: This script is inside a tool. The tool has a handle. The sounds and animation is inside the handle.

function onEquip()
    script.Parent.Handle.UnsheathSound:Play()
end

function onActivate()
    script.Parent.Handle.SlashSound:Play()
    script.Parent.Handle.Animation:Play()
end

script.Parent.Equipped:connect(onEquip)
script.Parent.Activated:connect(onActivate)

1 answer

Log in to vote
1
Answered by 8 years ago

You have to create a 'Animation' then load it into the Humanoid then Play it. So for example

local Animation = Instance.new('Animation')

Of course this creates the Animation itself.

animation.AnimationId = "http://www.roblox.com/Asset?ID="

Add the animation ID to the string after the "=". This loads the animation from the website and puts it into the newly created Animation.

local animTrack = Humanoid:LoadAnimation(animation)

The method name really says it all, it loads the animation into the humanoid.

animTrack:Play()

Now play the animation, and you're in business.

0
Note that this solution will only work from a local script. Link150 1355 — 8y
0
Oh woops forgot to say that, thanks. BinaryResolved 215 — 8y
Ad

Answer this question