how to send a command to a server only script

I have a enemy wave spawner that instantiates players on the network in waves. when all enemies in the wave are killed it starts another wave.

I’m trying to convert this script to a Networked version.
However I can’t find the proper way to subtract from the integer that holds how many enemies are left in the wave.

I have the spawning script attached to a Server-Only object. This way it will spawn the enemies on all clients only once without having multiple spawning scripts for each client, that are spawning their own zombies. however sense the object is only on the server I cannot find a way to reference it on the enemy script to subtract the enemies-left-in-wave integer in the spawning script.

so I am trying to send a command to a script that has a server only network identity attached to it. is this possible? if not is there another way to achieve this spawning system?

@aldonolleto

The server should be the only one that decides that an enemy was killed, not the clients. With that in mind, you don’t need to call a Command, you should be able to get the spawner instance on the server. If draging doesn’t work you can probably assign that reference after instantiating the enemy.

If you still want to let a client kill an enemy and tell the server, you can call Command on the local player object and since that Command runs on the server the spawner should be there.