RemoteFunction Help - Passed argument returns nil

Hello! I was recently rewriting code for my shop ui until I had encountered this issue:

lua 22:59:25.256 ServerScriptService.Main.ProductHandler:36: attempt to index nil with 'Name' - Server - ProductHandler:36

Investigating, I figured out that the serverscript, upon OnServerInvoke, receives guiObject as nil. guiObject is supposed to be ingameShop in this case.

LocalScript:

ingameShop.MouseButton1Click:Connect(function()
  print(ingameShop) -- Returns guiObject
  itemTable = passProductsFunction:InvokeServer(ingameShop)
  itemDispModule.onButtonInput(gameItem, itemTable)
end)

ServerScript:

passProductsFunction.OnServerInvoke = function(player, guiObject)	
	local itemTable

	print(guiObject) -- Nil		
	if guiObject.Name == "IngameShop" then
		itemTable = gameProducts
	elseif guiObject.Name == "PaidProducts" then
		itemTable = paidProducts
	elseif guiObject.Name == "Exchange" then
		itemTable = exchangeProducts
	end
	
	return itemTable
end

I am not sure why this issue is occurring, as it did not persist before. Any help is appreciated, thanks!

u cant sent unreplicated instances across remotes
player guis arent replicated

2 Likes

Thanks, will check this out the soonest