Table gets lost in RemoteEvents

I’m trying to transfer a table over to the parameters of a function, however, I only get the player twice, instead of the table I’m trying to send. Why is this?

function TheValleyFunctions.SubtractItem(Player,args)
	warn(Player,args)--Prints Player and Table
	game.ReplicatedStorage.Inventory.SubtractItem:FireServer(Player,args)
end
local function SubtractItem(Player,args)
	print(Player,args)--Prints Player and Player again
	local Inventory = InventoryTables[Player.UserId]
	local i = 1
	while true do
		if args["Item"..i] then
			local Subtract = Inventory:SubtractItem(args,i)
			i+=1
		end
	end
	
end
...
game.ReplicatedStorage.Inventory.SubtractItem.OnServerEvent:Connect(SubtractItem)
1 Like

.OnServerEvent already receives the player, so no need to send it in :FireServer.

Client code:

function TheValleyFunctions.SubtractItem(Player,args)
	warn(Player,args)--Prints Player and Table
	game.ReplicatedStorage.Inventory.SubtractItem:FireServer(args)
end

My bad. I forgot that it’s a default parameter

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