# Handling multiple arguments with custom commands

So, you’ve probably landed here after trying something like this:

```lua
MS:SubscribeAsync("tempmute", function(requestInfo)
    local requestdata = requestInfo.Data
    local player = requestinfo.player
    local duration = requestinfo.duration
    local reason = requestinfo.reason
    
    -- actual tempmute code here
end)
```

Unfortunately, this doesn’t work — and here's why:

\
Roblox only passes a single argument to your SubscribeAsync callback, which is requestInfo.Data. That means requestinfo.player, requestinfo.duration, and similar direct fields don’t exist by default.

## So how do you handle multiple arguments?

While Roblox doesn't support multiple arguments directly, there’s a workaround: parse the data string manually using regular expressions (regex).

Although this isn’t perfect or practical as regex can get messy if your inputs are unpredictable but afaik it's the only way to do this.

Regex allows you to define patterns to extract specific parts of a string. For example, if you want to extract all uppercase letters, you’d use a pattern like \[A-Z].

In our case, if you send a command like this:

<figure><img src="/files/WdaTmWsWB5BOpTWByKHa" alt=""><figcaption></figcaption></figure>

You can extract the values for player name, duration, and reason using this code and regex pattern:

<pre class="language-lua"><code class="lang-lua">MS:SubscribeAsync("tempmute", function(requestInfo)
<strong>    local data = requestInfo.Data
</strong>    local player, duration, reason = string.match(data, "^(%S+)%s+(%S+)%s+(.+)$")
    
    -- actual tempmute code here
end)
</code></pre>

This is what each thing means.

```regex
Regex pattern: ^(%S+)%s+(%S+)%s+(.+)$

^ – Anchors the pattern to the start of the string

(%S+) – Matches the first group of non-space characters (player name)

%s+ – Matches one or more spaces

(%S+) – Matches the second group of non-space characters (duration)

%s+ – Matches spaces again

(.+) – Captures everything else (the reason — including spaces and numbers)
```

Ps: please dont ask me for support about regex in the discord, i use chatgpt to write regex patterns since I don't understand how to write them.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jbz.dev/romod/ccs/multiple-args.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
