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.
01 | function onEquip() |
02 | script.Parent.Handle.UnsheathSound:Play() |
03 | end |
04 |
05 | function onActivate() |
06 | script.Parent.Handle.SlashSound:Play() |
07 | script.Parent.Handle.Animation:Play() |
08 | end |
09 |
10 | script.Parent.Equipped:connect(onEquip) |
11 | script.Parent.Activated:connect(onActivate) |
You have to create a 'Animation' then load it into the Humanoid then Play it. So for example
1 | local Animation = Instance.new( 'Animation' ) |
Of course this creates the Animation itself.
1 | 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.
1 | local animTrack = Humanoid:LoadAnimation(animation) |
The method name really says it all, it loads the animation into the humanoid.
1 | animTrack:Play() |
Now play the animation, and you're in business.