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

ServerScriptService.Game Logic:15: bad argument #2 (number expected, got table)????

Asked by 4 years ago
Edited by youtubemasterWOW 4 years ago

For some reason the script:

for i, v in pairs(game.Players:GetPlayers()) do
    if not v:FindFirstChild("InMenu") then
        table:insert(contestants,v)

does not work the word: table is highlighted but the word insert isnt highlighted even though in the tutorial video im watching. it is highlighted. And whenever i load the game i get this error message:

18:27:46.776 - ServerScriptService.Game Logic:15: bad argument #2 (number expected, got table)

Does anyone know how to fix this?

1 answer

Log in to vote
1
Answered by 4 years ago

You're incorrectly indexing the table. The appropriate format is table.insert ( array t, number pos = #t+1, Variant value ) not table:insert.

If this helped out, consider accepting this answer. If not, comment below and I'll be sure to help.

0
Yes this helped me thank you AwesomeHUnderwood! RealJustFoxin 2 — 4y
Ad

Answer this question