Script wont kick all players [SOLVED]

Any errors? send a picture of console.

image

image

Erm, can you show me the red text?

it is unrelated that is for missing sound id

1 Like

Wait, I think I know the issue please do the following instructions

Instructions

Remove the RemoteEvent Under DeathPoll2

but the script would not work if i did that

So why is there 2 remote events? its confusing.

there isn’t 2 events??? ------------

I reference it twice once in client and once in server

image
This is both the Exact Same just one with a number, one without, what are you using?

one for each team, the deathpolls show the current amount of players on team

Create a function in the server which will add all player health to a table. Then Iterate around that table checking if each value is less or equals to 0. If they are all lower or equal to 0 then return true and create another function that will kick all players

but the deathpolls do that but more simple

Personally using local scripts for these sort of things can be risky with exploits. I would recommend no remote events and purely just keeping this code server sided.

they can edit stuff in replicated storage?

Yes only on their side though.

I’m not sure about the exploitable part of this, but that part of the code should be:

for _, player: Player in pairs(game:GetService("Players"):GetPlayers()) do
      player:Kick("Game ended, because you killed the enemy team")
end

Delete the LocalScript, RemoteEvent, Keep the ServerScript and place it under “DeathPoll” or “DeathPoll2” (assumably that’s what you are using), and place this code inside (way more secure, will work)

local DeathPoll = script.Parent
DeathPoll:GetPropertyChangedSignal("Value"):Connect(function()
   if DeathPoll.Value == 0 or DeathPoll.Value < 0 then
      print(DeathPoll.Value)
      for i,v in pairs(game:GetService("Players"):GetPlayers()) do
            v:Kick("Game ended, because u killed the enemy team.")
      end
   end
end)

ok i will try this, I really hope it works