AmaaDivine Posted November 13, 2015 Share Posted November 13, 2015 (edited) Hi there! I'm having issues now..again. I managed to fix alot of everything. But now it crashes and gives this error when I go into the world.I have no idea what to do. I believe "nil" means non-useable number or something. No idea how to fix it. Here's the error [00:01:38]: [string "../mods/The Tiny One - DST/scripts/prefabs/..."]:51: attempt to index field 'health' (a nil value)LUA ERROR stack traceback: ../mods/The Tiny One - DST/scripts/prefabs/marrina.lua:51 in (upvalue) common_postinit (Lua) <42-64> scripts/prefabs/player_common.lua:1449 in (field) fn (Lua) <1360-1650> scripts/mainfunctions.lua:148 in () ? (Lua) <137-168> =[C]:-1 in (method) SendSpawnRequestToServer (C) <-1--1> scripts/mainfunctions.lua:1216 in (local) cb (Lua) <1214-1217> scripts/frontend.lua:523 in (method) DoFadingUpdate (Lua) <487-527> scripts/frontend.lua:575 in (method) Update (Lua) <535-684> scripts/update.lua:93 in () ? (Lua) <39-123> Edited November 13, 2015 by AmaaDivine Link to comment https://forums.kleientertainment.com/forums/topic/59005-51-attempt-to-index-field-health-a-nil-value-error/ Share on other sites More sharing options...
Mobbstar Posted November 13, 2015 Share Posted November 13, 2015 (edited) "nil" essentially means "no value". I assume the issue is that "comonents" has to be replaced with "replicas" when running as client. There's this useful snippet to aid you in achieving that: if TheWorld.IsMasterSim then --here goes the component stuffelse --here goes the replica stuffend Disclaimer: I am not a certified DST modder and have little experience with networking. Do not take my advice without keeping a safe copy of your file. EDIT: @AmaaDivine Edited November 13, 2015 by Mobbstar Link to comment https://forums.kleientertainment.com/forums/topic/59005-51-attempt-to-index-field-health-a-nil-value-error/#findComment-685903 Share on other sites More sharing options...
AmaaDivine Posted November 13, 2015 Author Share Posted November 13, 2015 "nil" essentially means "no value". I assume the issue is that "comonents" has to be replaced with "replicas" when running as client. There's this useful snippet to aid you in achieving that: if TheWorld.IsMasterSim then --here goes the component stuffelse --here goes the replica stuffend Disclaimer: I am not a certified DST modder and have little experience with networking. Do not take my advice without keeping a safe copy of your file. EDIT: @AmaaDivineI'm sorry, but I don't quite understand what I am suppose to do with that code you gave me. Where do I put it? It crashes when I start a new world, well go into the world.@Mobbstar Link to comment https://forums.kleientertainment.com/forums/topic/59005-51-attempt-to-index-field-health-a-nil-value-error/#findComment-685955 Share on other sites More sharing options...
Maris Posted November 14, 2015 Share Posted November 14, 2015 local fn = function(inst) if not TheWorld.ismastersim then return inst end Link to comment https://forums.kleientertainment.com/forums/topic/59005-51-attempt-to-index-field-health-a-nil-value-error/#findComment-685986 Share on other sites More sharing options...
Maris Posted November 14, 2015 Share Posted November 14, 2015 or move all instructions to master_init Link to comment https://forums.kleientertainment.com/forums/topic/59005-51-attempt-to-index-field-health-a-nil-value-error/#findComment-685987 Share on other sites More sharing options...
Mobbstar Posted November 14, 2015 Share Posted November 14, 2015 @AmaaDivine, never mind, I'm (as said) a big dum-dum when it comes to DST. Just do what Maris said. fn(inst)inst.soundname [...]if not TheWorld.ismastersim thenreturn inst inst:Addcomponent("health")[...]end Link to comment https://forums.kleientertainment.com/forums/topic/59005-51-attempt-to-index-field-health-a-nil-value-error/#findComment-686045 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