CottonDoodles Posted July 16, 2017 Share Posted July 16, 2017 I'm trying to create a custom backpack for this character, and I want the backpack to show up in their inventory when they spawn in. I've gotten other custom items to work (made a custom weapon), but I can't seem to get the backpack working. whenever I try to spawn into the world, I get this error: Quote [string "scripts/components/inventory.lua"]:637: attempt to index local 'inst' (a nil value) LUA ERROR stack traceback: scripts/components/inventory.lua:637 in (method) GiveItem (Lua) <636-769> scripts/prefabs/player_common.lua:1941 in (method) OnNewSpawn (Lua) <1937-1949> scripts/networking.lua:250 in () ? (Lua) <238-256> =[C]:-1 in (method) SendSpawnRequestToServer (C) <-1--1> scripts/mainfunctions.lua:1289 in (local) cb (Lua) <1287-1290> scripts/frontend.lua:538 in (method) DoFadingUpdate (Lua) <502-542> scripts/frontend.lua:590 in (method) Update (Lua) <550-707> scripts/update.lua:92 in () ? (Lua) <33-129> any help would be much appreciated Link to comment https://forums.kleientertainment.com/forums/topic/80637-help-making-custom-backpack-for-character/ Share on other sites More sharing options...
Yabumi Posted July 29, 2017 Share Posted July 29, 2017 Better late than never? Where did you put the code for this? It should look something like... local MakePlayerCharacter = require "prefabs/player_common" local assets = { Asset("SCRIPT", "scripts/prefabs/player_common.lua") } local start_inv = { "customitem" } local function common_postinint(inst) ... end local function master_postinit(inst) ... end return MakePlayerCharacter("character_name", prefabs, assets, common_postinit, master_postinit, start_inv) Link to comment https://forums.kleientertainment.com/forums/topic/80637-help-making-custom-backpack-for-character/#findComment-942472 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now