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

bad argument #1 to 'concat' (table expected, got string)?

Hello. I've recently run into this error whilst scripting? Can someone tell me why?

It works all the way up to the point of the print(table.concat) part.

Getting this error: bad argument #1 to 'concat' (table expected, got string)

Managers = { 
'zonit',
'EIijahMikaelson',
}

local function getValues(tableName)

print(table.concat(tableName, ", "))

end



Player.Chatted:Connect(function(Message)
Message = Message:lower()
if string.sub(Message,1,10) == '.getvalues' and isReady == true and isIntro == false and isManager() then
local tableName = string.sub(Message,11)
getValues(tableName)
	end
end)


7 comments

1

Forgot the add, the script itself is suppose to get all the values of the 'Managers' table and print it.

0

TableName is a string.

0

uhhh

0

wait u went through all of this to print the managers table?

0

There is code under it, but of course I need to make sure the print worked first.

0

How would I change the string into a way it counts as the table instead of the string?

0

maybe make it a table {tableName} on line 18

1 answer

✓ Accepted answer

if i catched ur question, this should work

local managers = {"zonit", "EIijahMikaelson"}

for i, v in pairs(managers) do
	print(v)
end

3 comments

0

the thing is, I don't need it to print. I want to put the values on a text label all in a row, so I tried to use concat to do so.

0

I'ts okay, found a way. Thanks anyway!

0

lol

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