• 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!

attempt to index a nil value

Fortera Global

Intermediate OT User
Joined
Nov 20, 2015
Messages
1,180
Solutions
2
Reaction score
117
Help? why this?

error:
Code:
Lua Script Error: [Monster Interface]
data/monster/scripts/newSummon.lua:onThink
data/monster/scripts/newSummon.lua:3: attempt to index a nil value
stack traceback:
    [C]: in function '__index'
    data/monster/scripts/newSummon.lua:3: in function <data/monster/scripts/newSummon.lua:1>

script:
Lua:
function onThink(self, interval)
    if self:isMonster() then
        if self:getMaster():isPlayer() then
            local creatureId = self:getId()
            local player = self:getMaster()
         
               if not SummonRegenEvents[creatureId] then
                SummonRegenEvents[creatureId] = addEvent(doRegenSummon, SummonRegenEvents.config.interval * 1000, creatureId)
            end
        end
    end
end
tfs 1 2
 
Code:
local master = self:getMaster()
if master and master:isPlayer() then
 
Solution
Back
Top