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

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

Asked by 3 years ago
Edited 3 years 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 3 years 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 461 — 3y
0
The problem can be with the humanoid or something. I cannot play any animation on that model. Shounak123 461 — 3y
0
I see it plays on the server side, but not on the client Shounak123 461 — 3y
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 189 — 3y
Ad

Answer this question