As the title suggests, I’m trying to figure out if there’s an alternative to “Humanoid”.
I have an NPC I’m trying to put into my game and when she has a humanoid, the game lags every time she’s put into the workspace, so I went ahead and made a custom model with 3D clothing, but I was wondering. Is there something I can put in place of Humanoid that’d still let her function as an NPC while letting the 2D clothing stay or is making custom rigs all I can do?
If I continue down the route of custom rig, I’ll have to redo all the animations I made for her, which is kind of annoying. If need be I’ll have to, but I’d like to avoid having to redo like 20+ animations. Entirely my fault for not doing this sooner, I’m a solo dev working on a game entirely alone so I’m learning things the hard way. Been practicing scripting for 2 years now and now is when I’ve finally reached a point where I am sufficient enough to make a game.
If anybody has any idea or suggestions, please let me know. Thank you for your time, your patience, and stay safe.
I think that before you go down this path, you should try to figure out why adding your humanoid to workspace lags your game.
There are known issues with humanoid not being very efficient when used in large numbers, but it sounds from your post like you are just adding one instance. If it is just one, then simplify it until you find the problem, e.g. remove all scripts that use it, remove custom anims, etc. until you find the source of the lag.
I have a room that within the room there is an NPC with a humanoid, and every time that the room is created/brought into the workspace WITH the NPC, there’s a 1-2 seconds freeze frame across all clients. I tested out the same process WITHOUT the NPC and there is not even a slight buffer. So I came to the conclusion that the NPC was the problem. The room is duplicated and parented to the workspace as needed.
I’ve already modeled a custom R6 rig with 3D clothing, just annoyed since I’ll have to redo all the animations for the NPC.
Please make sure that the Humanoid is not actually parented to the Workspace, as it can cause lag and other fun issues involving ṱ̵̊h̵͍̾e̸̳̽ ̵͇͑w̷̛̤o̸̝̚r̸͉͝k̷̥̋s̷̗̓ṕ̷̱a̶̲͛c̵̹̓ê̵̖ ̴̝̓b̴̬́ḛ̶̓ỉ̴̱n̶͇͒g̷̭̈́ ̴̯̑ä̷̞́ḽ̴͝i̶̝͊v̷̞̍e̷̟͝.
Well, I think it might be caused by a poorly written NPC controller. A single Humanoid NPC should not cause lag. It could also be the Humanoid’s “expensive” initialization causing a freeze during loading. Another possibility is a while loop without task.delay(), which can lead to runtime exhaustion (you should see an error like: "Script timeout: exhausted allowed execution time”).
i have a model with a character inside it, which has a humanoid, and when the room is cloned and parented to the workspace, the game freezes for a second or two, but without the character, you can’t even feel it.
I have no while loop, and even then there is no issue within the output to point to such. is there a way I could whittle down the Humanoid to the point where it doesn’t cause lag? I don’t need it to load physics, the character is going to be anchored regardless.
Humanoid is a subclass of AnimationController
Humanoid’s animations are controlled by the built-in script Animate, which is parented unto your Character model in run-time (yes, it can be replaced with custom script)
So as people have already pointed out, this isn’t a humanoid issue. i don’t know if you’re possibly leaving out important details you don’t know about, but a singular humanoid wouldn’t cause enough operations to lag your game.
That being said do you mind showing snippets of pieces of code in your game?
The only code regarding the NPC is just the cloning and parenting to the workspace, nothing else. I can show you the hierarchy though if that’ll do anything.
This fixed it. I feel kind of stupid, it was as simple as a single button press. I got rid of the AnimSaves model from Moon Animator 2 and it fixed my ENTIRE issue. Thank you so much eatabler0ck.