Hi, I am currently using TextChatService to apply chat tags, and that works fine, but when i want to add square brackets…
properties.PrefixText = table.concat(prefixes, " ") .. " " .. message.PrefixText
properties.PrefixText = string.gsub(properties.PrefixText, player.DisplayName, "[" .. player.Name .. "]")
the chat turns white and breaks:
However this piece of code…
properties.PrefixText = table.concat(prefixes, " ") .. " " .. message.PrefixText
properties.PrefixText = string.gsub(properties.PrefixText, player.DisplayName, player.Name)
works as normal:
So i was wondering how I could fix this? Any help would be appreciated, thanks!
1 Like
azqjanna
(azqjanna)
June 4, 2025, 9:31pm
2
Does it do this with any other characters? Try ( ) or putting just a letter before and after. Im thinking its a rich text escape issue, but I need you to try those to know.
1 Like
if it were an issue with RichText, they should try escaping it with a backslash(\
), although I don’t recall brackets([]
) being used in string formatting
1 Like
when showing the second piece of code it seems like it already has square brackets. am i missing something?
1 Like
no i mean the players name and not the chat tag
brackets seem to work in studio…
but not in game?
it seems to do it with every character i tried (brackets, stars, dashes etc)
azqjanna
(azqjanna)
June 5, 2025, 5:43pm
7
I have no idea what could be causing this then, sorry.
maybe its not the best to use table.concat in here
2 Likes