How would I be able to sent multiple arguments through a remote event to the client

Please can I have some help on how I would do this.

  1. What do you want to achieve? I am setting up some admin commands and I am trying to find a way to send over all arguments after the username said by the Notify command so I can give someone a notification.

  2. What is the issue? I am unsure on how I would send all arguments after the username

I appreciate all the help that I am given. :slight_smile:

1 Like

I have the command set up. Just not sure on how to sent multiple different arguments rather than the first word after the username said.

You can send however many functions you want in remote events

RemoteEvent:FireServer(arg1, arg2, arg3, …)

And then when the server listens for the remote firing, you must make sure you provide the valid number of arguments being sent to the server:

RemoteEvent.OnServerEvent:Connect(function(plr, arg1, arg2, arg3, …)
4 Likes

Hmm right. I am gonna have to make a limit to how many words can be sent then to the notification to the person. I wasn’t sure if they was a way of sending every argument after the one word without having specific argument limits (In terms of how many your send)

Well, in that case, variadic functions might help.

1 Like

Not sure what you mean but you can wrap multiple values inside a single table value if necessary.

2 Likes

Thank you. I remember this now. I appreciate the help. :slight_smile:

What I meant was, I wanted to fire every word said after the username when someone carries out the command. Like :Notify (Username) (Then whatever you want to notify then with.) I was seeing if I can fire over the whole notify message rather than having to send over every word individually and then limiting how long the notification message would have to be.

You can pass the entire string as a single value, yes. If you want to get the string’s length you can do one of the following.

local strings = "Hello world!"
print(#strings) --12
print(strings:len()) --12
print(string.len(strings)) --12
2 Likes