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

Why cant i add Players to the Table?

Asked by 7 years ago

Im just getting this error all the time :

Players.Player1.PlayerGui.Menu.Menu.Start Game.Start Game.Click:9: bad argument #1 to 'insert' (table expected, got nil)

here is the script

function EndMenu()
wait()
local frame = script.Parent.Parent.Parent
local play = script.Parent

for i , v in pairs(game.Players:GetPlayers()) do
    wait(0.5)
if v then
    table.insert(_G.gameplayers,v.Name)
    end
frame.Visible = false 
end
end

script.Parent.MouseButton1Down:connect(EndMenu)

I want that if u click the Textbutton you willö be added to the Table _G.gameplayers

1
Few questions: Is this a local or server script? Is _G.gameplayers defined? If _G.gameplayers is defined what script is it in, a local or server script? General_Scripter 425 — 7y
0
Why do you check if the player exists when the GetPlayers functions returns players that are in the game? TheeDeathCaster 2368 — 7y

Answer this question