Automatically rejoin player upon disconnecting from idle

title says it. how can i recreate a feature that auto rejoins a player when they disconnect from idle?

4 Likes

You can’t, once they get Disconnected, they are out of that Server, It is to preserve Roblox’s awful servers, it’s the equivalent of them leaving the game.

However what you could do instead, now, I’m not sure if I’m allowed to say this but, is to make a 19-minute loop, so when the time has elapsed, maybe somehow trigger a UserInput, maybe simulate a click, or a tap, or something to do with the UserInputService that might stop them Disconnecting.

Personally, I think there is a better reason why Roblox disconnects you, so either way I wouldn’t recommend doing that.

2 Likes

Here’s my code. Just like all my other code this will most likely not work. (I don’t know if 1190 seconds actually equals to 19:50)
There’s really not much purpose for doing this other than afk/grind servers.

StarterCharacterScripts btw

local players = game:GetService("Players")
local tpService = game:GetService("TeleportService")

local player = players.LocalPlayer or players:GetPropertyChangedSignal("LocalPlayer"):Wait()
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:WaitForChild("Humanoid")

local timeSinceLastMove = tick()

humanoid.Running:Connect(function(speed)
	if speed >= 0.01 then
		timeSinceLastMove = tick()
	end
end)

humanoid.Jumping:Connect(function(jumped)
	if jumped then
		timeSinceLastMove = tick()
	end
end)

while char.Parent do
	local currentTime = tick()
	--print(currentTime - timeSinceLastMove)

	if (currentTime - timeSinceLastMove) >= 1190 then
		tpService:Teleport(game.PlaceId)
	end

	task.wait(1)
end

Also I think seating or platformstanding may not trigger an idle disconnection so just in case maybe add some state checks

5 Likes

Yes, he’s correct!
You can use datastore (ProfileService for quick teleportation handling incase of dataloss) to handle if the player was doing some type of afk grind or smth. I also would recommend to use TS:TeleportAsync() instead of Teleport().

2 Likes

You shouldn’t be. If someone is idle for long enough to get auto kicked by their client then they’re clearly not playing and can easily join back when they get back to their device.

2 Likes

i see i see, thank you for letting me know

1 Like

thank you so much! you a real one

2 Likes

yup, thank you for telling me to useteleportasync :happy1:

1 Like

youre welcome (adding some more characters)

1 Like

Well it rly depends on what type of game. If its like an RNG and a player might be on another device where an external app like an AutoClicker cannot be used, the method above may be useful.

In your sense though, yeah it would rly not make sense

1 Like

maybe player.Idled useful

1 Like

Idk what autoclickers have to do with people being AFK?

well some games include like a built in afk system, so thats why.