Forever AFK help

I noticed in this game: AFK - Roblox You will get kicked, and rejoined but never “leave” how does this work?

2 Likes

Probably using so much TeleportToPrivateServer functions GEEZ

It’s something having to do relevant with TeleportService whenever a player joins the server

My guess is that the server creates a reserved server using ReserveServer by the moment a player joins, then teleports the player to that said “Private Server”

Then it checks if the Player is in a private server or not, if they are then it’ll teleport them back to the main game

And so the loop continues

2 Likes

Yep, that’s the case

Here’s the place reference I used to test this:

And the place file itself:
Wheeze.rbxl (28.0 KB)

Yeah I agree with @JackscarIitt It’s probably reserving a server for each player when they join, and then teleports them to the main game once the cycle finishes.

I’m a very beginner scripter and am trying to learn can you explain this a little more?

Just sending a API Reference won’t really help in this instance, sometimes you need to dumb it down more

So basically, when a player joins the AFK Game you provided in your OP, he will get teleported into what’s known as a Private Server

A private server is basically just a VIP Server, except done with scripting

Since the owner of that game wanted to only wanted to teleported that “player” in the same game, he referenced the same Place ID to teleport him in the same game, but a different server

–In the private server–

The game will check if the current server is a valid Private Server using the same code, if it is then that player that joined will get teleported back to the same game, but to the public server instead & not the private

So I did that but the game just loads a while then says game error.

Third Party Teleports need to be enabled in your Game Settings, otherwise it won’t work

It is enabled. Also I can hear my character bouncing.

Ok what error are you getting then? Does it show on the Output?

No everything seems fine, but when I join it shows loading screen.

Are you sure it isn’t just your internet
Did you use the place file I sent?

My internet is fine, let me check the file. My friend helped a little with the coding.

Ok files open, what would you like me to do? Copy the script?

Yeah just copy & paste the script, and embrace it in these symbols:

```This is a script```

Now I am really confused. Do I need to do anything other than enable 3rd world tp and paste script?

Just send the script here plz asokdsakfa

It should be 1 script located in ServerScriptService

I know.

local TPService = game:GetService(“TeleportService”)

game.Players.PlayerAdded:Connect(function(Player)

Player.CharacterAdded:Wait()

if game.PrivateServerId ~= 0 then
	TPService:Teleport(game.PlaceId, Player)
else
	local Code = TPService:ReserveServer(game.PlaceId)

	TPService:TeleportToPrivateServer(game.PlaceId, Code, {Player})
end

end)