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

Can someone help me out? - Expected <eof>, got 'else'

Im new to coding so i dont know what ive done wrong i'd really appreciate it if someone could help me out VVVVVV

Status.Value = "Get Ready To Play"

wait(2)

for i = Gamelength,0,-1 do
	
	for x, player in pairs(plrs) do
		
		character = player.Character
		
		if not character then
			-- left the game
			table.remove(plrs,x)
			
			else
			end
				if character:FindFirstChild("GameTag")
				then
					-- They are still alive
					print(player.Name.." is still in the game!")
				else
						-- they ded
						table.remove(plrs,x)
						
						
				end
		end
	end
	else
		table.remove(plrs,x)
		print(player.Name.." has been removed!")
		
	end
	
	Status.Value = "There are "..i.." seconds remaining, and "..#plrs.." players left"
	if #plrs == 1 then
		-- last person alive
		Status.Value = "The winner is "..plrs(1).Name
		plrs[1].leaderstats.Gold.Value = plrs[1].leaderstats.Gold.Value + reward
		break

		elseif #plrs == 0 then
			Status.Value = "Nobody won!"
			break
		elseif i == 0 then
				Status.Value ="Time up"
				

7 comments

0

Which line?

0

Make sure to properly indent your code

0

Its line 21 the else has a red underline

0

You don't need else on line 15 and click backspace once on line 16 before the end because that is ending the if statement before

0

I pasted the script and i got a error at line 28, the problem is you got 2 else or you are missing an if statement

0

I'm sorry I tried writing an answer but i don't understand the script. I don't get what your trying to do with all the if statements and else. Maybe on line 15 you're looking for elseif statement and if you are then you can remove the end on line 16

0

On line 28 i don't think you need the else statement, they only come with if statements and you haven't got an if statement for that else statement

1 answer

They are a few things wrong with your code. The first thing is that you added to else statements on line 21 and line 15. Your only supposed to have one else or one elseif. Second you don't need an end on line 33. 3. You can only have a break only when you have a loop like a return loop

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