This is the client script, in a ModuleScript that is required from a localscript:
function inventoryModule:addItem(item, category) local canContinue = remotes.InventoryAdd:InvokeServer(item) print(canContinue) if canContinue == true then print("item added") elseif canContinue == false then print("item not found; exploiter or bad connection") end end
The issue right now is not with the client script. Right now, the server-side function is not running at all:
remotes.InventoryAdd.OnServerInvoke = function(p, item) print(p.Name) if item then return true else return false end end
Nothing prints. I can change it to print anything, even random strings, and nothing. The server script is running, because if I do this:
local function addInventoryItem(p, item) print(p.Name) if item then return true else return false end end remotes.InventoryAdd.OnServerInvoke = addInventoryItem()
It works. A little bit. The arguments are not passed to the function, so I can an error for p.Name. If I delete the parentheses after remotes.InventoryAdd.OnServerInvoke = addInventoryItem(), which is what it's supposed to be, I get the same problem as before. In short, the server-side function is not running for some reason.