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

Why is my animated r15 dummy mesh not animating when I’m in game only in studio?

Asked by 3 years ago

I animated An r15 mesh but when I test It it does not play in the game. Yes I did put the animation Id in the script. This is what I put In the script

Local animation = script:WaitForChild (‘animation’) Local Humanoid = script.WaitForChild (‘humanoid’) Local dance = humanoid:LoadAnimation (animation) Dance:Play()

1 answer

Log in to vote
0
Answered by 3 years ago

I can tell you're new to scripting in Lua language. First, everything needs to be lowercased, expect for functions, strings, comments, and variables. That means every keyword has to be all lowercase. Functions need a ':' in order to have that function to run. You may have to fix the script.WaitForChild() into script.Parent:WaitForChild(). The reason I added the Parent part there is because we are referring to the script's parent, or if you are referring to the script itself, then that's probably why. Another thing to note is that you do not put spaces between the function and the parentheses, otherwise the script will get confused.

local animation = script.Parent:WaitForChild('Animation')
local humanoid = script.Parent:WaitForChild('Humanoid')
local playAnim = humanoid:LoadAnimation('animation')

animation.Looped = true -- depends if you want it looped or not
playAnim:Play()

If this helped you, you're welcome and I hope you have a great day.

Ad

Answer this question