Hello, I'm having issues with sending multiple parameters trough a server event. It just doesn't works, and I'm suffering because of this problem. Here are the scripts:
local script:
local wood = Inv.Materials.Wood local oldWood = 0 wood.Changed:Connect(function(player,newv) print(oldWood) local event = game.ReplicatedStorage.Inventory.Wood event:FireServer(newv,oldWood) wait() oldWood = newv end)
server script:
local Inventory = game.ReplicatedStorage.Inventory local wood = Inventory.Wood wood.onServerEvent:Connect(function(player,newv,old_Wood) print(newv) --123 print(old_Wood) --124 local value = newv - old_Wood print(player.."'s just got "..value.." Wood! Now he has "..newv.." Wood.") end)
Output: 17:40:49.263 nil - Server - Inventory:123 17:40:49.263 0 - Server - Inventory:124
Documentation for IntValue.Changed says that this event has only one parameter and that is the new value, you are expecting it to have 2 parameters where the first one is the player, this is not correct.
wood.Changed:Connect(function(player,newv) print(player, newv) end)
Example above will print you message in format:
number nil
You can fix this by having only single parameter in the function:
wood.Changed:Connect(function(newv)