How do I kill everyone inside of a specific team?
Asked by
4 years ago Edited 4 years ago
I am trying to kill everyone inside of a specific team once a button is pressed. I already dealt with connecting a remoteEvent to when a button is pressed, so I am able to put this on a normal script.
This is my code right now:
01 | local seconds = game.ReplicatedStorage.Seconds |
02 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
03 | local event = Instance.new( "RemoteEvent" , ReplicatedStorage) |
04 | event.Name = "EndRound" |
05 | local plrs = game.Players:GetChildren() |
10 | local function EndRoundNOW() |
11 | for i, v in ipairs (plrs) do |
12 | if v.Team = = "Playing" then |
13 | v.Humanoid:TakeDamage() |
16 | print ( "someone wants to end the round" ) |
20 | event.OnServerEvent:Connect(EndRoundNOW) |