So i wrote this down and it should work normaly but it gives me this error code
ServerScriptService.MainScript:140: '=' expected near '=='
Here is the script ( i got 2 teams 1 attacker and 1 defender )
Attackeralive = 0 Defenderalive = 0 for i = 20,0,-1 do status.Value = i.." seconds remaining" wait(1) if i == 0 then status.Value = "Defender won! Hostage is safe!" break else game.Players:GetPlayers()[_G.gameplayers].TeamColor == BrickColor.new("Lapis") then Defenderalive = Defenderalive + 1 end elseif game.Players:GetPlayers()[_G.gameplayers].TeamColor == BrickColor.new("Persimmon") then Attackeralive = Attackeralive + 1 end end if not Defenderalive == 0 and not Attackeralive == 0 then wait(1) end end if Defenderalive == 0 and Attackeralive == then status.Value = "Both Team got Eliminated!" end if Defenderalive > 0 and Attackeralive == 0 then status.Value = "The Defender won and rescured the Hostage!" wait(3) end if Defenderalive == 0 and Attackeralive > 0 then status.Value = "Attackers Eliminated all Defenders and got away with the Hostage" wait(2) end end end
On line 9 in the excerpt you posted, that else
should be an elseif
, and there should not be an end
on line 11.
It is a syntactic mistake to have a boolean condition after an else
statement.