@craftingboy26 , Hello again.
Sorry for disturbing you but, My system doesn’t work with multiple players…
As you can see, I made a LOT of changes into my system, here’s the code:
local teams = game:GetService("Teams")
local redTeam = teams:WaitForChild("Red")
local blueTeam = teams:WaitForChild("Blue")
local greenTeam = teams:WaitForChild("Green")
local yellowTeam = teams:WaitForChild("Yellow")
game.ReplicatedStorage.Events.RemoveFromTeam.OnServerEvent:Connect(function(player)
game.Teams:FindFirstChild(player.Team.Name):Destroy()
player.TeamColor = BrickColor.new("Medium stone grey") -- spectators
end)
game.Teams:WaitForChild("Red").PlayerRemoved:Connect(function(player)
if #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.Teams:WaitForChild("Red"):Destroy()
player.TeamColor = BrickColor.new("Medium stone grey") -- spectators
end
end)
blueTeam.PlayerRemoved:Connect(function(player)
if #blueTeam:GetPlayers() ==0 and blueTeam.EggBroken.Value == true then
blueTeam:Destroy()
player.TeamColor = BrickColor.new("Medium stone grey") -- spectators
end
end)
yellowTeam.PlayerRemoved:Connect(function(player)
if #yellowTeam:GetPlayers() ==0 and yellowTeam.EggBroken.Value == true then
yellowTeam:Destroy()
player.TeamColor = BrickColor.new("Medium stone grey") -- spectators
end
end)
greenTeam.PlayerRemoved:Connect(function(player)
if #greenTeam:GetPlayers() ==0 and greenTeam.EggBroken.Value == true then
greenTeam:Destroy()
player.TeamColor = BrickColor.new("Medium stone grey") -- spectators
end
end)
local plr
game.Players.PlayerAdded:Connect(function(player)
plr = player
game.ReplicatedStorage.Intermission.MatchStarted:GetPropertyChangedSignal("Value"):Connect(function()
if game.ReplicatedStorage.Intermission.MatchStarted.Value == true then
task.wait(0.01)
if player.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
end
game.Teams:WaitForChild("Red").PlayerRemoved:Connect(function()
task.wait(0.01)
if player.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
end)
greenTeam.PlayerRemoved:Connect(function()
task.wait(0.01)
if player.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
end)
yellowTeam.PlayerRemoved:Connect(function()
task.wait(0.01)
if player.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
end)
blueTeam.PlayerRemoved:Connect(function()
task.wait(0.01)
if player.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
end)
game.Teams:WaitForChild("Red").EggBroken:GetPropertyChangedSignal("Value"):Connect(function()
task.wait(0.01)
if player.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
end)
greenTeam.EggBroken:GetPropertyChangedSignal("Value"):Connect(function()
task.wait(0.01)
if player.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
end)
blueTeam.EggBroken:GetPropertyChangedSignal("Value"):Connect(function()
task.wait(0.01)
if player.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
end)
yellowTeam.EggBroken:GetPropertyChangedSignal("Value"):Connect(function()
task.wait(0.01)
if player.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
if player.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(player)
end
end
end)
end)
end)
game.Teams:WaitForChild("Red").PlayerRemoved:Connect(function()
task.wait(0.01)
if plr.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
end)
greenTeam.PlayerRemoved:Connect(function()
task.wait(0.01)
if plr.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
end)
yellowTeam.PlayerRemoved:Connect(function()
task.wait(0.01)
if plr.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
end)
blueTeam.PlayerRemoved:Connect(function()
task.wait(0.01)
if plr.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
end)
game.Teams:WaitForChild("Red").EggBroken:GetPropertyChangedSignal("Value"):Connect(function()
task.wait(0.01)
if plr.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
end)
greenTeam.EggBroken:GetPropertyChangedSignal("Value"):Connect(function()
task.wait(0.01)
if plr.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
end)
blueTeam.EggBroken:GetPropertyChangedSignal("Value"):Connect(function()
task.wait(0.01)
if plr.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
end)
yellowTeam.EggBroken:GetPropertyChangedSignal("Value"):Connect(function()
task.wait(0.01)
if plr.Team == game.Teams:WaitForChild("Red") then -- player is on the red team, same applies for all.
if #game.Teams:WaitForChild("Red"):GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == greenTeam then -- player is on the red team, same applies for all.
if #greenTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and blueTeam.EggBroken.Value == true and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == blueTeam then -- player is on the red team, same applies for all.
if #blueTeam:GetPlayers() >= 1 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and #greenTeam:GetPlayers() == 0 and #yellowTeam:GetPlayers() == 0 and yellowTeam.EggBroken.Value == true and game.Teams:WaitForChild("Red").EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
if plr.Team == yellowTeam then -- player is on the red team, same applies for all.
if #yellowTeam:GetPlayers() >= 1 and #greenTeam:GetPlayers() == 0 and #blueTeam:GetPlayers() == 0 and #game.Teams:WaitForChild("Red"):GetPlayers() == 0 and game.Teams:WaitForChild("Red").EggBroken.Value == true and blueTeam.EggBroken.Value == true and greenTeam.EggBroken.Value == true then
game.ReplicatedStorage.Events.rewardWin:FireClient(plr)
end
end
end)
I also added a die detector as you can see:
script.Parent:WaitForChild("Humanoid").Died:Connect(function()
if game.Teams:FindFirstChild(game:GetService("Players"):GetPlayerFromCharacter(script.Parent).Team.Name).EggBroken.Value == false then
for i, Child in pairs(script.Parent:WaitForChild("Humanoid"):GetChildren()) do
if Child:IsA('ObjectValue') and Child.Value and Child.Value:IsA('Player') then
local Killer = Child.Value
if Killer:FindFirstChild "leaderstats" and Killer.leaderstats:FindFirstChild "Kills" then
game.ReplicatedStorage.DiedRE:FireServer(Killer, Killer.KillEffect.Value)
end
return
end
end
else
game.ReplicatedStorage.Events.RemoveFromTeam:FireServer()
end
end)
Help please?