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

For i,v in pairs(game.Players:GetPlayers()) do doesn't work?

So, I am making a round game. So basically you wait in the lobby for 30 seconds and after that a round starts and your force field gets removed so you can fight, then after 150 seconds you get sent back to the lobby and it repeats. Everything seems fine but the for i,v argument. No errors or underlines. Can someone help? The script's below.

local intermission = script.intermission
local inround = script.inround
local players = game.Players:GetPlayers()
local label = game.StarterGui.gamegui.Frame.GameLabel
intermissiontime = 30
roundtime = 150
while true do
	for i,v in pairs(game.Players:GetPlayers()) do
		v.TeamColor = BrickColor.new("White")
		v:LoadCharacter()
		Instance.new("ForceField", v.Character)
	end
	intermission.Value = true
	label.Text = "Intermission(30s)"
	wait(intermissiontime)
	intermission.Value = false
	label.Text = "Round In Progress(150s)"
	for i,v in pairs(game.Players:GetPlayers()()) do
		v.TeamColor = BrickColor.new("Maroon")
		v:LoadCharacter()
	end
	wait(roundtime)
end

1 answer

✓ Accepted answer

Line 4, change

local label = game:GetService("StarterGui").gamegui.Frame.GameLabel

to this:

local label = game:GetService("Players")LocalPlayer:WaitForChild”PlayerGui”

2 comments

0

I know, I know this one, i put this aside, but the for i,v doesn't work, it does not change the team to white when the player joins. I know I can use AutoAssignable on the White team, but I disabled it for a test.

0

Do you even know what syntax highlighting is?

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