How to know if player died server side efficiently for this

hi…so i’ve been doing my battle game which is you spawn in the lobby and then you go to a teleporter which takes you to the battle zone in another game.
Well, what I want is a way, through a script, of how to know if all the players from the other team have died and if only 1 from the other team dies, then put them in a spectator mode, I don’t want a script, just tell me how. I do thank you very much Hello, thank you very much. I already made the equipment folder and the values are added there, but I need to know if the entire equipment died somehow? thanks

Once the match started you are allowing more incoming players to join teams?

If the battle zone is a place different to the StartingPlace then.
First, I would create a server table containing the players of each team, populate that table on PlayerAdded.
Connect a Humanoid.Died event too, when that event is triggered, edit the server table changing the value of each player to false.
With that table you can keep track of how many players remaining alive.
With the Die event you can just fire a remote event to run client functions for the camera to make the player to spectate.

1 Like

no, when the game starts no one else can enter unless a player enters but a little late

1 Like

Well, in that way. I have a way to make that.

  • Add a folder inside of ReplicatedStorage called Players

  • Add a script inside of ServerScriptService and add StringValues for each player inside of the Players folder using the and game.Players.PlayerAdded function

  • After that, add a LocalScript inside of StarterCharacterScripts and get the Humanoid of your character and script the Died function.

  • Once you did that, if the Player dies, it deletes it’s StringValue from the folder (You’ll have to do that.) and then toggle the spectator gui and done.

I do not know if this has any sense but i tried helping you. :sweat_smile:

Goodluck! :four_leaf_clover:

1 Like

So you want a queue system?

If the player deletes the client script connected to Died event?
I would not recommend that approach, pretty easy for exploiters to “hack” that.

Well, aslong as they can only hack it by client-side (will only be destroyed for them), it’s safe i guess

I dont think so, cause that approach is depending on the client to know when they died, then tell server to delete the “string”.
If I delete/disconnect that Died event, server will never know that I died.

Never trust client, theres no need to have a client script reading the Died event.

He could use


local character = plr.Character



But i don’t think that is also a solution.

1 Like

I agree with keeping all tracking in server side, exactly as that.
I still prefer to do everything in server tables instead of adding strings to folders, etc.
Its cleaner and more efficient

I have an idea. create a folder on the server side and save the invalues with the name of the players and when the player dies the intvalue.Value says false and the rest will already know it

Hello, thank you very much. I already made the equipment folder and the values are added there, but I need to know if the entire equipment died somehow?

How your PlayerAdded event looks like right now?

When player joins, you are populating a folder with values, right?
Just connect the died event in there, within that PlayerAdded and CharacterAdded event.

1 Like

hey thanks I already found another solution thank you very much but you still helped me with the first message


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.