Hiding a certain prefix in bubble chat

Hey Developers, I’m trying to find the best way to hide text after a prefix, I’ve tried a few different methods and it’s not working out too well for me.

For instance, ingame if I say @Hello it’ll show up in the bubble chat as @Hello, What I am trying to accomplish is when I say @Hello or anything after an @ it will hide it in the bubble chat, and no player will see it.

What’s the best way to come about doing this?

Well, I would probably not use the default BubbleChat to start - I’d make a custom bubble chat and script it to act like the normal bubble chat. (Personally I don’t love how bubble chat looks by default, so this is how I customize it). Then, I’d parse out all of the prefixes in the function that creates the bubble ui over the player’s head. To parse out the string, I personally use string.gsub, but there might be a better method ¯\_(ツ)_/¯
For your example, you’d do

local text = "blah blah @hello"
local subLocation = string.find(text, "@")
if subLocation then
local textToHide = string.sub(text, subLocation)
finalText = string.gsub(text, textToHide, "")
end

This most likely isn’t the best method, but it’s a method.

First off, make a custom bubble chat system if you want full on customization. Then, if the message contains a @, simply do not display it.

Check if string contains a @:

local msg = '@hello'
local containsAt = string.sub(msg, 1, 1) == '@'