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

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

Asked by 6 years ago

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.

01local intermission = script.intermission
02local inround = script.inround
03local players = game.Players:GetPlayers()
04local label = game.StarterGui.gamegui.Frame.GameLabel
05intermissiontime = 30
06roundtime = 150
07while true do
08    for i,v in pairs(game.Players:GetPlayers()) do
09        v.TeamColor = BrickColor.new("White")
10        v:LoadCharacter()
11        Instance.new("ForceField", v.Character)
12    end
13    intermission.Value = true
14    label.Text = "Intermission(30s)"
15    wait(intermissiontime)
View all 23 lines...

1 answer

Log in to vote
2
Answered by 6 years ago
Edited 6 years ago

Line 4, change

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

to this:

1local label = game:GetService("Players")LocalPlayer:WaitForChild”PlayerGui”
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. mudathir2007 157 — 6y
0
Do you even know what syntax highlighting is? Griffi0n 315 — 6y
Ad

Answer this question