Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

3 comments

0

i get everytime an error if i put anyhting in those brackets

0

Where is line 140 lmao?

0

xd Line 140 is line 9

1 answer

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.

4 comments

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

0

On line 20 you have a missing number. You have 'Attackeralive == then', instead of 'Attackeralive == 0 then'.

0

I LOVE U MAN

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.