Jump to content

:51: Attempt to index field 'health' (a Nil Value) Error


Recommended Posts

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>

 

post-502721-0-44367700-1447379689_thumb.

Edited by AmaaDivine
Link to comment
Share on other sites

"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 stuff

else

 --here goes the replica stuff

end

 

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 by Mobbstar
Link to comment
Share on other sites

"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 stuff

else

 --here goes the replica stuff

end

 

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

I'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
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...