Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

why isnt my checking for alive players working? :) should be alright normaly

Asked by 7 years ago
Edited 7 years ago

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

0
i get everytime an error if i put anyhting in those brackets Paintertable 171 — 7y
0
Where is line 140 lmao? WHITEHH 0 — 7y
0
xd Line 140 is line 9 Paintertable 171 — 7y

1 answer

Log in to vote
1
Answered by
duckwit 1404 Moderation Voter
7 years ago

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.

0
Now i get another Error its line 20 the "Then" is red underlined, If you could help me out that would be amazin! im nearly finished with my whole script Paintertable 171 — 7y
0
On line 20 you have a missing number. You have 'Attackeralive == then', instead of 'Attackeralive == 0 then'. duckwit 1404 — 7y
0
I LOVE U MAN Paintertable 171 — 7y
0
LOVE U TOO. Mark the answer as accepted when you're done with a question, this makes it easier for helpers to spot unanswered questions. duckwit 1404 — 7y
Ad

Answer this question