I have a remote event that when fired does some other things but its also supposed to add to a value in a players inventory (a table with the players table within a serverdata table).
Inventory = {
ex = 0,
ex2 = 0
}
That is what their inventory table looks like. Whenever the remote event is fired passed with it is the player and the item that they are trying to pick up. In the onserverevent script I have it updating the value.
When you do Inventory.item it looks for the key named item inside Inventory. When you use Inventory[item] it uses the value of the variable item to index Inventory
Also if you’re using number types NOT NumberValues for elements in your table you might want to do Inventory[item] = Inventory[item] + 1 (In your example you used number types)
I don’t understand what you mean. However the #help-and-feedback:scripting-support category is not created to teach you Lua, only to solve problems with your code. You seem to lack basic knowledge and I recommend to watch or read tutorials on Lua tables and related things.
The use of tables has already been documented in the Internet and there’s no need to post such questions on the DevForum.
I figured it out. When I was sending the item name I was using mouse.target for other things in a function to pick it up and when did FireServer I wasn’t sending the name of the item. (was using mouse.Target rather than mouse.Target.Name)