So I am making a RTS game, and right now I have the building done.
The Local script is serving for the ui and building at the same time, I have a server script which gets the fired event from the local script and places the buildings at the mouse position tho.
Do I code the spawning of troops in that same script or?
it really depends on the structure of your code and how modular you want your scripts to be.
if you want to keep things organized, it might be a good idea to create a separate script for spawning troops. this way, each script has its own responsibility - one for building placement and one for troop spawning. it can make your code easier to maintain and debug.
however, if the troop spawning is closely tied to the building (for example, troops can only be spawned at certain buildings), it might make sense to include the troop spawning code in the same script. this could potentially make the interaction between buildings and troops more straightforward to handle.
you should choose the one that feels the most comfortable with you.