Hello, i’m trying to make animation for NPC, my question is how to do that. I have animation ready (ID 5953951628
)
Thanks.
Hello, i’m trying to make animation for NPC, my question is how to do that. I have animation ready (ID 5953951628
)
Thanks.
Hello. This is fairly easy for something to do. Add an animation into the NPC and then change the types of animation. In one case, you will have to upload animations to the roblox library. Here is one example on how to use the animation editor:
This is a question that you should know when learning coding, please do some research of the tutorials before making these topics.
That’s the exact reason they’re coming here. To get help on coding. This came off as sort of rude.
But what happens if this category is only asking basic questions on scripting that can be already known through Roblox tutorials?
It is very easy to set up something like this.
If you haven’t already, insert a dummy into the workspace, and insert a script into the dummy model, and create a animation inside of the humanoid and set its ID to your animation ID.
Then type out the following code(bits of it are explained in comments)
local dummy = script.Parent -- The model containing the NPC itself
local humanoid = dummy:WaitForChild("Humanoid",60) -- The NPC humanoid
local animation = humanoid:WaitForChild("NpcAnimation",60) -- The animation for the NPC itself, also it doesn't really need to be named "NpcAnimation", just change the string to whatever you named it
local animationtrack = humanoid:LoadAnimation(animation) -- The animation track
-- Play the animation
animationtrack:Play()
When you play, the animation should play!
Sorry for late reply, it doesn’t work. No errors in console
I was searching tutorials, none of them works some of them have errors in console and some don’t print anything. I was trying to find something for 2 hours before making this post. Also if you don’t want to help you don’t have to.
Oops, I just realized that :LoadAnimation()
is deprecated.
Use the new animator instead.
Same function, just change what loads the animation.
@luketeam5 this is because Humanoid:LoadAnimation() is now deprecated. So, instead on humanoid, there’s something called an Animator under humanoid, so use Animator:LoadAnimation() instead.