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

onLook problem on god account

Dran Ryszard

Member
Joined
Apr 25, 2023
Messages
52
Reaction score
12
Location
Poland
Hi, i make script for onLook my upgrades on characters, but when i check normal player from god account, then i get error, when im look from normal player to god/normal player then its okey, only if God tried look normal player (when he look on self then its ok)

Lua:
local onLook_UPKI = EventCallback

function onLook_UPKI.onLook(player, thing, position, distance, description)
    if thing:isPlayer() then
        local check_AS = player:getStorageValue(CUSTOM.ATTACK_SPEED_UPGRADE)+1
            description = string.format("%s\n[AS: %s/s]", description, check_AS)
    end
    return description
end

onLook_UPKI:register(2)

errors:
Code:
Lua Script Error: [Event Interface]
data/events/scripts/player.lua:Player@onLook
...TS\data\scripts\eventcallbacks\player\default_onLook.lua:44: attempt to index global 'player' (a nil value)
stack traceback:
        [C]: in function '__index'
        ...TS\data\scripts\eventcallbacks\player\default_onLook.lua:44: in function 'callback'
        ...a\Desktop\ParcelOTS\data\scripts/lib\event_callbacks.lua:131: in function 'EventCallback'
        data/events/scripts/player.lua:4: in function <data/events/scripts/player.lua:1>
 
local check_AS = player:getStorageValue(CUSTOM.ATTACK_SPEED_UPGRADE)+1
IDK how player can be nil, but player is player that is looking at someone, not player you are looking at.
So it should be:
Lua:
local check_AS = thing:getStorageValue(CUSTOM.ATTACK_SPEED_UPGRADE)+1
To view storage value of player you are looking at, which is called thing in onLook script.

Error is reported in data/scripts/eventcallbacks/player/default_onLook.lua. Is it your script or is there a problem with default TFS script, after you added your new script?
 
IDK how player can be nil, but player is player that is looking at someone, not player you are looking at.
So it should be:
Lua:
local check_AS = thing:getStorageValue(CUSTOM.ATTACK_SPEED_UPGRADE)+1
To view storage value of player you are looking at, which is called thing in onLook script.

Error is reported in data/scripts/eventcallbacks/player/default_onLook.lua. Is it your script or is there a problem with default TFS script, after you added your new script?
Okey thanks, i change "player" to "thing", but problem be in default TFS script, i forgott about few changes what i maked yesterday, before i added new script for onLook :D
 
Back
Top