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

I Need help Help With Using v Variable In Brackets?

Asked by 3 years ago
Edited 3 years ago

Here is the part of the script where it is erroring, It is erroring on line 5.

function PlayerStatus()
    PlayersReady = 0
    Players = game.Players:GetChildren()
    for i, v in pairs(Players) do
if game.Players[v].PlayerGUI.ScreenGui.SettingsGUI.InteractiveGUI.Settings.AfkModButton.Text == "OFF" then
            PlayersReady = PlayersReady + 1
        end
    end

So supposidly this would check if the selected player is afk or not and if they are not we will add players ready + 1, and we would do that for every character.

The question is while when I use the variable v in that case it does not work, and I dont know how I would detect the playername.

0
I would like if you used code blocks. Dovydas1118 1495 — 3y
0
You are indexing with the value instead of the actual number/index. i is for indexing v is for the object. if game.Players[i] killerbrenden 1537 — 3y
0
That did not help, could you please provide a code sample Gooncreeper 98 — 3y
0
You can't access other players PlayerGui's from the client and server. DevingDev 346 — 3y
0
You cant?? Gooncreeper 98 — 3y

Answer this question