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

error toposition

Sigoles

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

Code:
Lua Script Error: [Action Interface]
data/actions/scripts/mix.lua:onUse
data/actions/scripts/mix.lua:16: attempt to index a nil value
stack traceback:
    [C]: in function '__index'
    data/actions/scripts/mix.lua:16: in function <data/actions/scripts/mix.lua:6>

LUA:
local buckets = {
    [22387] = 22388,
    [22388] = 22387
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not target or type(target) ~= "userdata" or not target:isItem() then
        return false
    end
    if target:getId() == 1285 then
        --
        --
        return true
    end 

    local BotMoney = Tile(toPosition):getItemById(2160)
    if BotMoney then
    end
 
end
 
Last edited by a moderator:
there is no 16 lines in this code, but if Tile(toPosition) is nil it can give you a nil value error.
 
you need to check if tile.
LUA:
local tile = Tile(toPosition)
if tile then
 
Solution
Back
Top