Is it better to have one server script or multiple for each player?

Should the gun :FireServer() to one script in ServerScriptService to deal the damage

Or should all guns have their own individual serverscript that does the server side stuff.

I fidn it’s easier to dish damage through one server script because that way you don’t have to go back and edit the scripts just to change something or add an effect when players die. I try my best to consolidate my scripts into one Script, one LocalScript, and the rest being ModuleScripts.

Sometime I get delays from :FireServer() to deal damage to another player.

Is this because my code is inefficient? or my Internet

It’s because of latency: the physical time it takes from data to travel from end of the world to another. You can deal damage both on the client and on the server: reduce the healthbar on the client just to show the client that it responded to the damage. Then, the real damage would be done on the server, which is the final judge for determining damage, deaths, and kills.

1 Like