Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 9 days ago
Edited 9 days ago

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

Log in to vote
0
Answered by 8 days ago

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
0
Thanks, but it didn't work. I think the problem is the other way. Shounak123 160 — 8d
0
The problem can be with the humanoid or something. I cannot play any animation on that model. Shounak123 160 — 8d
0
I see it plays on the server side, but not on the client Shounak123 160 — 8d
0
I just seen you were working with viewport frames, which I am not so familiar with. Very sorry that this didn't work :/ sean_thecoolman 173 — 7d
Ad

Answer this question