Unable to cast value to Object Error

Hi Other Developers,

I’ve been trying to create this Inventory System with Datastores and I’ve been trying to send a RemoteEvent over to a client but in the output it gives the error “Unable to cast value to Object”

Here is my code for the serverscript, keep in mind this is not all of it:

game.Players.PlayerAdded:Connect(function()
    -- ...
	if InventoryItemsData ~= nil then
		print(InvItemsData) -- Prints out a table
		LoadInv:FireClient(InvItemsData) -- Error is here
	end
end)

Thanks a lot!

1 Like

You should be able to pass tables just fine as arguments for remote events. How complex is this table? Does it follow the argument limitations for remote events?

It’s a folder containing children that’s serilized into a table, heres what it prints

image

and the code that serilizes the table of children:

local function SerilizeObj(Table)
	local InvList = {}
	for _, v in Table do
		table.insert(InvList, v.Name)
	end
	return InvList
end

uhm, you didnt append player?

game.Players.PlayerAdded:Connect(function(player) <-------
LoadInv:FireClient(player, InvItemsData)
1 Like

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