New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help.
Log in to vote

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

Asked by 8 days 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
Answered by 8 days 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

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


Answer this question