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

Append string to text?

Sorry for the weird title, I couldn't figure out how to word it properly...

Anyhow, I want to make this:

playSound(sounds.("Table"..(math.random(1,5)))

work so that these would look like this:

playSound(sounds.Table1)

through

playSound(sounds.Table5)

1 answer

✓ Accepted answer

So I'm guessing this is what you mean:

playSound(sounds["Table"..(tostring(math.random(1,5))])

For strings you need to use square brackets.

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