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

Lua Error get:Position

Fortera Global

Intermediate OT User
Joined
Nov 20, 2015
Messages
1,180
Solutions
2
Reaction score
117
I'm tried to make an script to send effect on player but got error, help?:

Lua:
function onThink(interval, lastExecution)

local spec = getSpectators({x = 30685, y = 30485, z = 9}, 7, 7)
if spec ~= nil then
     for _, s in pairs(spec) do
         if isPlayer(s) then
         s:getPosition():sendMagicEffect(8)
         end
     end
end


return true
end


Error:

Code:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/others/Effets.lua:onThink
data/globalevents/scripts/others/Effets.lua:7: attempt to index local 's' (a number value)
stack traceback:
    [C]: in function '__index'
    data/globalevents/scripts/others/Effets.lua:7: in function <data/globalevents/scripts/others/Effets.lua:1>
[Error - GlobalEvents::think] Failed to execute event: EfetAcid


tfs 1.2
 
Solution
Code:
local players = Game.getSpectators(Position(x, y, z), false, true, 7, 7, 7, 7)
if players ~= nil then
    for i = 1, #players do
        local player = players[i]
        player:getPosition():sendMagicEffect(8)
    end
end
Code:
local players = Game.getSpectators(Position(x, y, z), false, true, 7, 7, 7, 7)
if players ~= nil then
    for i = 1, #players do
        local player = players[i]
        player:getPosition():sendMagicEffect(8)
    end
end
 
Solution
Back
Top