local TeleportService = game:GetService(“TeleportService”)
local UserInputService = game:GetService(“UserInputService”)
local player = script.Parent.Parent
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild(“HumanoidRootPart”)
local idleTime = 0
local maxIdleTime = 1120
task.spawn(function()
while true do
task.wait(1)
idleTime = idleTime + 1
print(idleTime)
local currentPosition = hrp.Position
if (currentPosition - lastPosition).Magnitude > 5 then
idleTime = 0
lastPosition = currentPosition
end
if idleTime >= maxIdleTime then
TeleportService:Teleport(game.PlaceId, player)
break
end
end
this happens when u try to rejoin to a server when youre the only player in the server, so it just shuts down and kicks u, the only solution for this is to tp to a privateserver, but im guessing you dont want them to get a free privateserver, so here is your answer
Yeah you’re trying to teleport to the same server you’re already the only player there, Roblox will kick you out of the server first which will cause the server to be shutdown since there’s no player on it at the moment. When you connect to the server again through the teleport the server is already gone hence you see the Disconnected error. It’s a racing condition that your teleport request will still find the same server to join during matchmaking, while it’s not shutdown yet. By the time your client tries to connect it’s been shutdown. Sorry we don’t have a good solution for this racing condition.