So um I have a game where there are 2 teams. On the 2 teams there are many warrior nps who will fight each other. Each one has its own script to find an enemy and attack and inside each npc is a weapon with its own scripts. The weapons use .touched events to detect hits. This is needed so they can detect shields being hit and not damage the shield user. The npcs also use roblox animations tracks (not cframe) to attack or walk. Everything is server-sided.
On studio because it runs on my pc the npcs can fight each other although it lags. But when I run it in a real roblox server in game nothing even runs. The npcs are stuck in one place and cant move because of the lag. I am looking for ways to optimise my game. Ive tried making my own humanoid system but it would be too difficult for me and I cant. If you can please give me ways how roblox games tackle this issue. I want to know how games like Ages of Warfare 2 can sustain many npcs without the game lagging so much. Only difference between my game and that game is that mine uses a lot of collisions from .touched events and is very accurate about where the blade hits.
This is what it looks like when I run it in studio:
This is what it looks like when I run it in game:
Unfortunately I cant upload the footage dev forum keeps giving me errors but basically nothing moves. The arrows stay in the air for so long there are like many of them in the air at once. Everything moves so slowly or doesnt move at all. The game cant run.
This is the game btw: Battle Simulator 2 - Roblox