• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Error Nil value

Sigoles

Discord: @sigoles
Joined
Nov 20, 2015
Messages
1,209
Solutions
2
Reaction score
154
error:

Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/onDeath/Kollos.lua:onDeath
data/creaturescripts/scripts/onDeath/Kollos.lua:5: attempt to index local 'killer' (a nil value)
stack traceback:
    [C]: in function '__index'
    data/creaturescripts/scripts/onDeath/Kollos.lua:5: in function <data/creaturescripts/scripts/onDeath/Kollos.lua:1>

script:
LUA:
function onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
  
    local player = Player(killer)
  
    if killer:isPlayer() then
        if player:getStorageValue(2006170043) < 10 then
              
                    player:setStorageValue(2006170043, math.max(0, player:getStorageValue(2006170043)) + 1)      
              
        end       
    end
  
    return true
end

tfs 1.x

help? I dont know how reproduce
 
Last edited by a moderator:
Code:
 local player = Player(killer)
Wtf is this? Remove it.

add this under ondeath
Code:
if not killer then
    return true
end
 
Solution
Back
Top