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.

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

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

Line 4, change

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

to this:

local 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