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

Play non-Local Animations?

Asked by 8 years ago

Can someone explain me how to play non-local Animations? The wiki said there's a method but it isn't pretty clear about it. Please explain to me.

0
Could we have the wiki article? We can try to interpret it for you. Legojoker 345 — 8y
0
http://wiki.roblox.com/index.php?title=API:Class/Animator/LoadAnimation and before taking you to that page the wiki says "To animate from a non-local script, Animator.LoadAnimation should be used." Slazerick 55 — 8y

1 answer

Log in to vote
0
Answered by
Legojoker 345 Moderation Voter
8 years ago

I made the comment without realizing I had actually messed with animations a while ago...anyway, LoadAnimation simply preps the animation for use. The animation ID of the object classnamed "Animation" must correspond to an existing created ID (just like sounds, shirts, and all other things along the lines of online content). Once this is complete, simply create code connecting the animation to the humanoids of your choice:

local person = game.Workspace:WaitForChild("Dummy1"):WaitForChild("Humanoid")
local animatorRun = person:LoadAnimation(game.Workspace:WaitForChild("Runner"))

and here is the corresponding workspace for the said environment (ignore the charactermeshes, I was using a body mesh for my penguin):

http://prntscr.com/8nuzyl

Now then, every time you want your animation to run, use this code:

animatorRun:Play()

:Play() can be spammed as much as you would like to run the animation; it as unlimited use as long as the model continues to exist. Keep in mind that Play has three parameters that must be used all together if used at all (you can keep it blank the way I have it and it will work fine). The first one is fadeTime, which obviously determines how much time you give the animation to fade. The second one is called "weight," and I'm not really sure what that one does. If someone has any information on that, feel free to contribute. Lastly, there is speed, which is a ratio number that you can use to choose how fast or slow your animation goes, similar to the Pitch property in sounds. Hope this helped, if it did make sure to check this as the answer; it gives both of us rep!

Ad

Answer this question