Hello! I have been trying to make a script that transports a table from a client to a server, but my test has now shown anything and it's almost as if it doesn't run? Please help.

--Client--

script.Parent.Confirm.MouseButton1Click:connect(function()
	if #script.Parent.Order:GetChildren() >= 1 then
		script.Parent:TweenPosition(UDim2.new(-0.793, 0,0.173, 0),0,1,1)
		clientmsg("Success","Your order has been sent to our crew and will be served to you at cruise, thank you for flying with Harbour Airways.")
		game:GetService("ReplicatedStorage").FoodBooking.PlaceOrder:FireServer(script.Parent.Order:GetChildren())
	else
		clientmsg("Error","You must have one or more items in your order.")
	end
	
end)

--Server--

game:GetService("ReplicatedStorage").FoodBooking.PlaceOrder.OnServerEvent:connect(function(plr,order)
	local item = Instance.new("StringValue",game:GetService("ServerStorage").PlrFoodData)
	item.Name = "-"
	local clone = item:Clone().Parent
	for i,v in pairs(order) do
		print(order)
	end
end)

It does not print the table as it is meant to.

9 comments

1

Have you tried printing through both scripts to check if it runs through, prints the information you want to send to the server in the client-script, the event gets fired on the server-side, etc?

1

May be trying setting the table as a variable instead of the thing itself???

1

Try for_,v in pairs(script.Parent.Order:GetChildren()) do

0

you can also unpack the table and send the values that way.

0

For security reasons you cannot send the server a table from the client.

0

I have before, if not then How am I going to do this??^

0

Sorry OP. What I meant is you can't pass userdata from the client to server.

0

Why do you need to send userdata to the server? You can make a table of strings to send to the server instead. Remember that the server will only accept integer indexed tables (else it auto converts).

0

I am trying to send a table not a userdata. ^