I have this error and I don’t know how to fix it, any help?
[script:esx_inventory] SCRIPT ERROR: @esx_inventoryhud_trunk/server/trunk.lua:71: attempt to index a nil value (local ‘vehicle’)
[script:esx_inventory] > getOwnedVehicule (@esx_inventoryhud_trunk/server/trunk.lua:71)
[script:esx_inventory] > MakeDataStore (@esx_inventoryhud_trunk/server/trunk.lua:83)
[script:esx_inventory] > GetSharedDataStore (@esx_inventoryhud_trunk/server/trunk.lua:98)
[script:esx_inventory] > handler (@esx_inventoryhud_trunk/server/trunk.lua:106)
Hey 
Can you show us what’s the content of your ‘owned_vehicles’ table in you database ?
The entries should look like that :
Ok this is the structure, but can you show us the content ?
Yes, this. Oh that weird, try to do some print testing in ''inventoryhud_trunk/server/trunk.lua", around line 71 try to print ‘v.owner’, ‘v.plate’, ‘v.vehicle’ and before that maybe ‘json.encode(result)’ .
I haven’t changed it yet. This is the current version. Can you guys help me see what’s wrong there?
Yeah I know I have the same code in my test server, the error shouldn’t event happen as there is a condition stating that it will only execute the line 71 “If result != nil and #result sup 0”. So if the query doesn’t deliver we shouldn’t get the error and if she delivers and the database table structure and content is good (which seems to be the case) we shouldn’t see the error either 
Add the following line to your code and see what pops up on your server console:
I find the situation strange, so I did some testing on my test server and I have no issue with this part of the code at all.
Opened the trunk door but no response