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

RevScripts Spells teleport tfs 1x

alcapone

Member
Joined
Jan 13, 2021
Messages
98
Reaction score
10
I'm trying to create a spells for a monster that can send some players from the screen to another location
my code below is closing the server
function onCastSpell(creature, var)

local spectators = Game.getSpectators(Position(33711, 31470, 14), false, false, 14, 14, 14, 14)
for i = 1, #spectators do
local spec = spectators
if spec:isPlayer() then
spec:teleportTo(Position(33780, 31470, 14))
spec:getPosition():sendMagicEffect(CONST_ME_TELEPORT)

end
end

return true
end
 
Solution
try:
Lua:
function onCastSpell(creature, var)
    local spectators = Game.getSpectators(Position(33711, 31470, 14), false, false, 14, 14, 14, 14)
    for _, spec in ipairs(spectators) do
        if spec:isPlayer() then
            spec:teleportTo(Position(33780, 31470, 14))
            spec:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        end
    end
    return true
end

Snavy

Bakasta
Senator
Joined
Apr 1, 2012
Messages
1,247
Solutions
71
Reaction score
587
Location
Hell
try:
Lua:
function onCastSpell(creature, var)
    local spectators = Game.getSpectators(Position(33711, 31470, 14), false, false, 14, 14, 14, 14)
    for _, spec in ipairs(spectators) do
        if spec:isPlayer() then
            spec:teleportTo(Position(33780, 31470, 14))
            spec:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        end
    end
    return true
end
 
Solution
Top