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

My NPC's animation is not playing correctly. Help?

So, I created an NPC named Dawn, and used a viewportframe to render it to GUIs. Dawn is and R15 model, and is child of the viewportframe. I set a script under "Dawn" and written the following:

local animation = script.Parent.Humanoid:LoadAnimation(script.Parent.Female_Run)

animation:Play()

The output doesn't show any error. the Female_Run is an Animation and its ID is 507767714. It doesn't play the animation and doesn't show any error in the output. Please help I need to know about the problem. Thanks in advance!!

1 answer

The main problem is that you never instance a new animation.

In order for it to work, you must create a new animation instance via 'Instance.new'.

local animation = Instance.new("Animation") --Creates an animation
animation.AnimationId = "rbxassetid://507767714" --Gives the animation an asset ID, I used yours
local control = script.Parent.Humanoid --An animation requires a control, which can be a humanoid or an AnimationController
control:LoadAnimation(animation):Play() --This loads the animation in "LoadAnimation"s parameter and plays it

4 comments

0

Thanks, but it didn't work. I think the problem is the other way.

0

The problem can be with the humanoid or something. I cannot play any animation on that model.

0

I see it plays on the server side, but not on the client

0

I just seen you were working with viewport frames, which I am not so familiar with. Very sorry that this didn't work :/

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