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

attempt to index local 'AllPlayers' (a nil value)?

Asked by 5 years ago

So I wanted To Make A Folder Which Holds The Players Name With String Value + Its Name And I wanted to Get The Players By :GetChildren And This Error Comes Up. I would Appriciate Some Help :)

script.Parent["Player Count"].Changed:Connect(function(val)
    print(val)
    for i=1,val do
        local PlayersFold = script.Parent.Players
        local AllPlayers = PlayersFold:GetChildren().Value
        local Player2 = AllPlayers[i]
        local Char = workspace.WaitForChild(Player2):FindFirstChild("Humanoid")
        local Player = game.Players:GetPlayerFromCharacter(Char)
        local PlayerGui = Player.PlayerGui.ScreenGui        
        if (PlayerGui.Frame.Visible == false) then
            PlayerGui.Frame.Visible = true 
        end
    end
end)

Answer this question