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

For loop ieterating through players broken. Could someone explain?

Asked by 10 years ago

I've inserted a value into each player that joins the game called, "player" but this script isn't working.

--Made by Aceta

players = game.Players:GetPlayers()

function getPlayers()
    for i, v in pairs(#players) do
        if v.play.Value == false then
            Instance.new('Message', Workspace).Text = 'yay we can start'
        end
    end
end
0
When you use "v.play.Value", are you trying to access your "player" value? SanityMan 239 — 10y
0
No, there's a boolValue in each player called "play" RedneckBane 100 — 10y
0
Ermegherd. I never called the freaking function. I forgot I made it a function. -facepalm- Take this as a lesson kids, never code on a late night. RedneckBane 100 — 10y

1 answer

Log in to vote
1
Answered by
2eggnog 981 Moderation Voter
10 years ago

It's pairs(players) not "pairs(#players)".

Ad

Answer this question