Why are the parameters being flipped when passed?

I’m trying to pass name and number values to a client script to be added to an inventory. But on the client side, the values are flipped. Example: Server–Item1 = “Cedar Log”. Client side–Item1 = 39. (Also Num3 doesn’t get passed through. It ends up with a number on the server but nil on the client.)
Server Side

local Item1 = "Cedar Log"

local Num1

local Item2 = "Stick"

local Num2

local Item3 = "Cedar Sapling"

local Num3

local Item4 = nil

local Num4 = nil
Num1 = math.random(12,23)
			Num2 = math.random(41,59)
			Num3 = math.random(1,5)
			if math.random(1,1000) == 99 then
				Item4 = "Bird Egg"
				Num4 = math.random(1,3)
			end
			--Parameter order: player, Logs, # Logs, Sticks, # Sticks, Saplings, # Sapings, Bird Eggs, # Bird Eggs
			game.ReplicatedStorage.Inventory.AddItem:FireClient(player,Num1,Item1,Num2,Item2,Num3,Item3,Num4,Item4)

Client Side

local function FillSlot(player,Num1,Item1,Num2,Item2,Num3,Item3,Num4,Item4)
	print("-------------------")
	print(Item1)
	print(Item2)
	print(Item3)
	print(Item4)
	print("-------------------")

Output


The EEEEEEEEE was added to find the number easier.

I’m pretty sure that the player isn’t a parameter within OnClientEvent, so when you are expecting the parameters player, num1, item1, num2, etc. on the client, as player isn’t a parameter, that means that num1 is becoming player, item1 is becoming num1, etc.

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