Can return only pass one argument?

So my client fires a remote function, the server does its thing, and now I’m trying to return several tables created by the server sided function. I cant do return (table1,table2,table3) because it gives me nasty red squigglies. Am I just doing something wrong? Or am I going to have to pass them as arguments via remote event?

1 Like

Could you post the code you’re using?

That way it will be easier to see what might be going on.

1 Like

if there’s a red underline, it’s a problem with syntax, not anything that occurs during runtime

So here is the basics:

table1 = {}
table2 = {}
table 3 = {}

function FillTables()
table1 = {“There are a lot”}
table2 = {“Of things”}
table3 = {“In each of these tables”}
end

script.Parent.RemoteFunction.OnServerInvoke:connect(function(plr)
return (table1,table2,table3) – problems to be had
end)

while true do
FillTables()
wait(60)
end

Try removing the parentheses on the return line:

script.Parent.RemoteFunction.OnServerInvoke:connect(function(plr)
   return table1,table2,table3 -- problems to be had
end)

EDIT: Since you are using a RemoteFunction, see @StarWars reply.

2 Likes

Thats pretty lame.
I like my parenthesis.

Thanks <3

OnServerInvoke is a Callback function, not an event

http://wiki.roblox.com/index.php?title=API:Class/RemoteFunction/OnServerInvoke

Try doing

script.Parent.RemoteFunction.OnServerInvoke = function(plr)
	return table1, table2, table3
end
5 Likes