What do you want to achieve? Keep it simple and clear!
Trying to achieve a hoard of infected as much as, 50-200.
What is the issue? Include enough details if possible!
Whenever it gets to the number of 70 it starts frame-dropping all players heavily. (20-40fps)
What solutions have you thought of so far?
Currently using a 1 script for all AI’s tagged, CollectionService, Humanoid Tagging, Reducing HumanoidStateTypes, using a custom animator for animations, Collisiongroups, and set all infected parts to the “Box”, Collisionfidelity.
All infecteds that attack the player do not use a Touched.Event or just a Touched. They all use magnitudes and are using roblox’s default pathfinding. Whenever the player gets near a spawner for the infected, they usually spawn per infected every 2 seconds. Usually, 40-50 infected gets the best performance in the server but nowhere close to the hoard amount that I set.
I don’t have a solution, I’m lacking in the know-how of a lot of what might be relevant here.
But try finding the specific cause of the lag.
Is it the existence of 70 instances that causes the problem or the script’s operation of 70 instances?
If you took 70 instances (purely the models) and put them in a room would that cause lag?
If not, if you slowly started adding functionality at what point does the problem occur?
By lag do you mean frames or a delay in your game’s functions?
How much of your AI (whether the appearance or the code) is handled by the client?
What information is being handled by your code, some things are more data-expensive than others?
If you’ve ever played World of Magic (a game that used to exist on Roblox) it had many, many fully functioning AI NPCs, I think nearly 100 if not more. Based on my experience, I think it handled optimization by destroying instances (Re-added when needed) and pausing functionality of AI that are too far from players.
I remember this:
That I saw a while ago and it seemed very informative.