Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How Do You Make The Animation Play On The Player?

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

✓ Accepted answer

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.

2 comments

0

Note that this solution will only work from a local script.

0

Oh woops forgot to say that, thanks.

This discussion is preserved as it was. New answers, comments, and votes are closed.