Teleportation Script

Hey, fellow devs.

I have been working on a game with a friend, but we want to do a few huge changes.

What we want to achive

Well, it’s simple.
We need to learn how to make a script to teleport a player to the new game instantly after joining the game.

Is this possible? Probably is, we’re new to scripting and need you help!

More questions

Is this good for a game, or bad?
How will this happen?


Thanks for coming, hope we get feedback soon! :smiley:

It is possible, but I don’t see why you need to do this. Just have the players join the new game instead of having it teleport them to it when they join the game.

The game is changing massiveley, and we feel this is the right thing to do.

Players wouldn’t normaly go on there profile just to play, unless there a huge fan.

Thanks for your feedback.

You should use TeleportService to teleport the player when they join.

First you should make some variables:

local TeleportService = game:GetService("TeleportService") --the service used to teleport the player
local placeId = 0 --put the placeId of the game you want to teleport the player to

After that, you will want to make a function for when a player joins.

local function onPlayerAdded(player)
    TeleportService:Teleport(placeId, player)

Then you will have to run the function when a player joins.

1 Like

Sure, I would say to document more before making a post or search for tutorials on similar subjects but here is a script that should work.

-- >> VARIABLES << --
local Place_Id = nil -- add your place id
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")

-- >> EVENTS << --
    TeleportService:Teleport(Player, tonumber(Place_Id))
1 Like

Thanks for the feedback, I’ll be sure to use these!

1 Like