Code: Select all
script.on_event(defines.events.on_tick, function(event)
if event.tick % 5 == 0 then
local p1 = global.portal1.entity
local p2 = global.portal2.entity
if p1 and p2 then
if p1.valid and p2.valid then
for index, player in pairs(game.players) do
if player.connected and player.character and player.vehicle == nil then
try_teleport_1(player)
try_teleport_2(player)
end
end
end
end
end
end)