Can plugins read Commandbar?

I have a plugin and I wish to print how to use it but I dont want a whole button or gui just for that.
So I thought if you wrote ‘help’ in commandbar then it’d print how to use it.

So my question is, is it possible to read what someone writes in commandbar using plugin?

You can accomplish this using the LogService.MessageOut event, although your command will need to be prefixed with -- so that when it is processed by the command bar it is treated as a comment so it won’t error.

For example:

game:GetService("LogService").MessageOut:Connect(function(Message)
    if Message == "> --help" then
        -- stuff
    end
end)

Would catch entering --help into the command bar (after enter is pressed).


(Thanks to @FieryEvent for showing me this!)

13 Likes

Genious!

This is a really cool idea. I’ll have to remember this.