Table not sending properly (Bug or error?)

So I’m writing this script essentially long story short it’s an order system, the table consists of 3 items, when I attempt to send the table to the client side, it for some reason like sends as an empty table? I’m not sure if I’m making a dumb mistake or if it’s a bug, maybe someone can please help. Important bits of code are below as well as output screenshot
Server Script:

game.ReplicatedStorage.OrderSubmitted.OnServerEvent:Connect(function(player, orderInfo, ordersTarget)
	local staffMember = nil

	if #orderQueue > 0 then
		staffMember = orderQueue[1]
		table.remove(orderQueue, 1)

		print(orderInfo)
		print("Length of orderInfo: " .. #orderInfo)  -- Print the length of the table

		-- Sending order details as a table
		game.ReplicatedStorage.OrderRecieved:FireClient(staffMember, orderInfo)  -- Send orderInfo directly

		for i, remainingPlayer in ipairs(orderQueue) do
			game.ReplicatedStorage.UpdateQueuePosition:FireClient(remainingPlayer, i)
		end
	end

	local ticketNum = currentTicket + 1
	currentTicket = ticketNum

	if staffMember then
		local char = game.Workspace:FindFirstChild(ordersTarget)
		local ticketNumDisplay = script.TicketNumDisplay:Clone()
		ticketNumDisplay.Frame.Name1.Text = "Ticket #" .. ticketNum
		ticketNumDisplay.Parent = char:WaitForChild("Head")
	end

	return staffMember
end)

Local Script:

game.ReplicatedStorage.OrderRecieved.OnClientEvent:Connect(function(player, staffMember, orderInfo)
	notiText.Text = "Order Received!"
	notificationFrame.Visible = true
	notiSlideIn(notificationFrame)

	orderDisplayFrame.Visible = true

	if type(orderInfo) == "table" and #orderInfo == 3 then
		for key, itemFrame in ipairs(itemFrameHolder) do
			if itemFrame:IsA("TextLabel") and orderInfo[key] then
				print("Setting itemFrame.Text for key " .. key .. ": " .. orderInfo[key])
				itemFrame.Text = orderInfo[key]
			end
		end
	else
		print("Received orderInfo is not a table with 3 elements.")
	end

	wait(3)
	notiSlideOut(notificationFrame)
end)

Let me know if you know whats wrong, or if you need more information! Thank you!

2 Likes

Can you directly print orderInfo, on the client and server side for me really quick, and send the results?
Then, in the client side, print staffMember as well.

1 Like

Sure, very top {} is the print of orderInfo on the Server Side. Then I printed the client sided ones with a string so you can read them easier. Looks like they’re both printing nil on the client side for whatever reason, strange part is, the task I have assigned for the staffmember completes just fine on the clientside, it’s just a simple gui.

2 Likes

I see the issue now, your using these events wrong!

Change:
game.ReplicatedStorage.OrderRecieved:FireClient(staffMember, orderInfo)
To:
game.ReplicatedStorage.OrderRecieved:FireClient(player, staffMember, orderInfo)
Change:
game.ReplicatedStorage.OrderRecieved.OnClientEvent:Connect(function(player, staffMember, orderInfo)
To:
game.ReplicatedStorage.OrderRecieved.OnClientEvent:Connect(function(staffMember, orderInfo)

You had the order flipped!

Wow, the stupid mistakes I make when developing for like 8 hours until unhealthy late hours. :joy::rofl: I’m not sure how I didn’t see that… thank you!

1 Like

Dont worry man, I make the exact same mistakes from time to time!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.