I have an anti-afk teleport system in my game where it teleports you back to the game after 15 minutes of inactivity. The issue I’m running into is that if the player is in a private server, then the game just kicks them when the teleport is activated.
How would I teleport that player to the same private server that they are in?
I’m using a module script I found online called SafeTeleport, but I don’t think that has anything to do with my issue. The packets.teleportPacket.listen
is basically just a remote event.
Here’s the code I’m using right now for the teleport.:
local ServerScriptService = game:GetService("ServerScriptService")
local RS = game:GetService("ReplicatedStorage")
local SafeTeleport = require(ServerScriptService.Modules.SafeTeleport)
local TeleportService = game:GetService("TeleportService")
local ByteNet = require(RS.ByteNet)
local packets = require(RS.ByteNet.packets.packets)
function AntiAfkServer.Start()
packets.teleportPacket.listen(function(data, player)
if data.eventtype == "afkTeleport" then
local placeId = 115224377076663
local options = Instance.new("TeleportOptions")
options:SetTeleportData({
inInfinite = data.value,
afkTeleport = true
})
SafeTeleport(placeId, {player}, options)
end
end)
end