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

Why is immediately stopping the code while it is not supposed to?

I'm making a round system for a game and I made a game length variable to indicate when the time is up but right when it starts the game runs it even though there are 43 seconds left, Can anyone help me?

local gameLength = 43

for i = gameLength,0,-1 do

		for x, player in pairs(playersAlive) do
			if player then

				character = player.Character

				if not character then
					-- Left the game
				else
					if character:FindFirstChild("GameTag") then
						-- They are still alive
					else
						-- They are dead
						table.remove(playersAlive,x)
						print(player.Name.." Has been removed!")
					end
				end
			else
				table.remove(playersAlive,x)
				print(player.Name.." Has been removed!")
			end
		end

if i == 0 then
	status.Value = "Times up!"
	wait(2)
	break
end

4 comments

0

Error message ?

0

nope

1

I am pretty sure you need to define player, player by its self is not a valid statement.

0

I dont know if this is the problem but you never added the end for the "for i = gameLength,0,-1 do" statement

1 answer

player is not a valid statement. You need to define it. You could try adding, local player = game:GetService("Players")

3 comments

0

They have defined player, actually, in the "for x, player" statement. And I'm guessing that they classified "playersAlive" earlier in the script

0

Playersalive is a table to get every player

0

Oh shoot did not see that.

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