Can you pass multiple arguments through Remote Functions?

So, I’m still new to coding and I know that you can pass multiple arguments through Remote Events, but can you do the same with remote functions?

EX:

function timer2.OnServerInvoke()
	return gametime.Value,gamemode.Value
end 

Yes, but what you’re doing isn’t passing arguments. Your parameters are defined in the parenthesis beside OnServerInvoke and arguments are what you pass when you do InvokeServer from the client.

You can return multiple items from a RemoteFunction. They will be sent back as a tuple which you can access either by assigning variables in a single line or catching the returns in a table. The former is recommended over the latter.

function RemoteFunction.OnServerInvoke()
    return 1, 2
end

local first, second = RemoteFunction:InvokeServer()
7 Likes