How can i get all the words that come after a command trigger for a announcement command?

Im making a custom command system, which also includes a announcement command.

In of it the command can be triggered in any spot even after a couple of messages

heyyy :announce yo!

input: “yo!”

but i would like to know how to get all the words that come after

heyyy :announce yo, hi guy!

input: “yo, hi guy!”

1 Like

you can basically do this with string patterns!

local Pattern = ":command%s.+"
local Result
   if msg:match(Pattern) then
        Result = string.gsub(msg, ":command%s", "")

What is this pattern matching?


“:command” is obviously matching “:command”

%s matches a white space or a space

And .+ matches all letters after the space

Should work but I can’t test rn

If you’d like to tweak it, learn more about string patterns here:


And I am aware I could use sub patterns instead of string.gsub

but I’m too lazy to do it unless you really want me to do it

1 Like

Doesn’t really matter as your 1st post was a solution. thanks mate

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.