Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

1 comment

0

Yes this helped me thank you AwesomeHUnderwood!

This discussion is preserved as it was. New answers, comments, and votes are closed.