Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I hide messages in my chat gui if they start with a few specific characters?

Asked by 8 years ago

Hello, I was wondering if anyone could help me learn how I can hide messages in my chat gui if they start with "/e " (including the space after the e). I am using the chat gui script and set up from this tutorial http://wiki.roblox.com/index.php?title=Custom_chat_GUI. All of my code is the same as that code, so I figured it would be less space consuming if I just provided a link.

When hiding a players message that starts with "/e " I would also like to make sure that the message isn't counted into the chat GUI (so the player's name and their text content won't appear nor will there be an empty space, it will simply act as if no message was given.

I would like to note that the message still needs to be accepted because I'm trying to simply block out my admin commands from the chat GUI so people can't see when they're used or what they're used for.

If anyone can help me, it would be greatly appreciated!

0
You could use the substring function to check if the first few characters are equal to the command to hide the chat. (msg:sub(1, 3) == '/e ') TheeDeathCaster 2368 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Use string.sub(MessageVariable,startposition (usually 1), end position (length of string your checking for)) Eg:

if(string.sub(messagegoeshere,1,2) == "/e") then
...
end
Ad

Answer this question