Today I am trying to create animated duplicates of player characters. For the most part, I have been able to achieve this. But the facial animations of the dynamic heads won’t play on NPCs.
Players:CreateHumanoidModelFromDescription() have I tried. I even duplicated my
Player’s character from the explorer, yet the results remain the same.
Is there something that I am missing? Do the dynamic head animations only work for players as of now? Are there any workarounds for this?
(I am not trying to create my own dynamic head, I am just trying to create NPCs with the appearances of player characters with dynamic heads equipped.)
Wow fire blink animation what game is this?
Animate script is a
LocalScript and the duplicate player is not your character, so the animate script won’t run.
Animate script’s code is made so that it can just be directly made into a server-sided
Script and run. If not, it should be pretty easy to adapt.
I believe a server-sided version of the (This is not the case my bad)
Animate script exists if you use the humanoid rig builder in
Avatar as well.
Facial animations just use regular Roblox animations from what I saw, so having the animate code running server sided for your NPC should have it start animating the face as well.
Adapting the animate script is pretty straightforward and doesn’t require any programming knowledge.
- Just copy the code inside the
LocalScript into a new
- Name the
Animate like the old one if you’d like, though this isn’t necessary, it probably just makes sense to.
- Bring all the stuff inside the old
Animate script into the new server sided one.
- Then, lastly, just remove the emote chat hook code that I’ve pasted below, since it uses the
LocalPlayer which is
nil on the server:
-- setup emote chat hook
local emote = ""
if (string.sub(msg, 1, 3) == "/e ") then
emote = string.sub(msg, 4)
elseif (string.sub(msg, 1, 7) == "/emote ") then
emote = string.sub(msg, 8)
if (pose == "Standing" and emoteNames[emote] ~= nil) then
playAnimation(emote, EMOTE_TRANSITION_TIME, Humanoid)
That should be it.
My character doesn’t use facial animations, but, by following the steps above I was able to make this rig of my character dance:
I just ran the following code in the command bar to target the rig by name and invoke the
PlayEmote bind that exists inside the
Thank you, this worked for me. If I had a lot of player characters to copy, would animating on the server like this be performant-heavy?
Also, using this method, what is an efficient way of replicating the original player’s live animations to the dummy? Currently, I am using
Animator.AnimationPlayed on the original
Animator and playing those tracks on the duplicate character’s.
It’s a dynamic head named bill that you can get from the avatar shop.
Most likely not really, the animations are still processed by the client and in general the animations aren’t going to contribute to much time spent unless you’ve got thousands of humanoids. The physics from the humanoids probably contribute more lag than the animations would, but that’s also something that you need hundreds or thousands of to begin to experience any real noticeable problems with, so that’s almost definitely not a concern.
If you want to copy the animations from the source player then that does sound like the best way to do that. That probably means you don’t need the
Animate server script either though since you’re relying on the clients’ code to decide what animations need to play and when, unless you want the NPC to be able to walk and move and all that on its own, and play the proper animations at the proper times.
If the latter is the case, the
Animate script contains a bunch of
StringValue objects (with no value) and inside of those, they have some
Animation instances. In order to copy the animation set, you can simply loop over the children of the server sided animate script for your NPC, clear all the
StringValue instances, and then copy the ones from the player’s
Animate script will watch for those
StringValue objects to be added/removed and will update the animation set that the humanoid uses based on those.
(Also idk why they are
StringValue instances but the animate script is ancient, from a time when Roblox didn’t have
Folder instances, so that’s probably what they were using instead and just continue to use for compatibility with any really old code)
That will let you move and control the NPC character however you want e.g. via
.Jump = true, etc and it will have all the animations of the original player and will play them at the correct times and in the correct ways consistent with how they would play for the other player.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.