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

How to add strings to messages using tables?

In a message, how do you add table strings(?) to the message's text?

table={"hi","pizza","four"}
mes=Instance.new("Message",workspace)
mes.Text=""..table.."" -- trying to make it say: Text="hi, pizza, four"
-- No, I'm not trying to do: mes.Text=""..table[1]..""..table[2]..""..table[3]..""
-- WHAT IS THIS SORCERY

I'm sorry if this is confusing.

1 answer

✓ Accepted answer

So.. you're trying to make it have all the elements in a table, but not have to list each one individually?

--Anyway if that's what you meant, then use "table.concat".

local table = {"Hey","More pizza","Five"}
mes = Instance.new("Message", Workspace)
mes.Text = table.concat(table," ") 

--The first argument is the table, the second argument is what seperates each element. E.G if I were to put 'table.concat(table,"!")', then the message text would be "Hey!More pizza!Five"

1 comment

0

Thanks!

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