Combine names into text with spacing?

So I bascially have this script that puts boolvalues named a certain sentence name into a folder, and when the player presses sentence, it will combine all the bool value names and put them into 1 long text, how would I go about doing the text part, with spacing and “,” in between? image

1 Like
local final = { }

for _, reason in ipairs(reasons) do
    table.insert(final, reason.Name)
end

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

It goes through the reasons, assuming it is a table, inserts the children’s names, and prints them out separated with comma and space.

But why are you using BoolValues for this?

No reason for the boolvalues, just a way of keeping it, but would this work?

	local final = { }

    for _, reason in ipairs(Gui.Menu.Reasons:GetChildren()) do
    table.insert(final, reason.Name)
    end

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

Yes that will work

Don’t use bool values, or another value in general, because you’re not even using them the way they’re supposed to be used: to share boolean information across scripts.

I recommend using tables and inserting the sentences into that table.