How to teleport players to new game?

Hello!

Basically, I made a game and moved it to another, a group game. I want to teleport players that join the game to my new game! How do I do this?

5 Likes

You should use TeleportService.
Developer Reference

1 Like

insert a script into the part, once it gets touched, it’ll make sure to teleport. let me know if it doesn’t work.

local TeleportService = game:GetService(“TeleportService”)
local placeID_1 = put in og id place
local placeID_2 = put in upcoming id place
local function onPartTouch(otherPart)
local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
if player then
TeleportService:Teleport(placeID_1, player)
end
end
script.Parent.Touched:Connect(onPartTouch)

1 Like

Is there any method with like joining the game and then directly getting sent to the new one?

try making a new part directly on the spawn and if players try moving around, they’ll be teleported directly to the new game

1 Like

Like what I mean is basically if you can add a teleport(placeid_2) to make sense to it, without having to like manually make the local placeid2 instead of having it only for one.

game.Players.PlayerAdded:Connect(function()
--Teleport script
end)

This event fires when a player joins the game.

1 Like

Isn’t that only for local scripts? And doesn’t TeleportService only work with server scripts?

game.Players.PlayerAdded works anywhere. In both serverscript and localscript. It’s also useless in localscripts because essentialy local scripts start running when a player joins.

@anross and please don’t spoonfeed scripts, try to explain the script next time and format it correctly.

2 Likes

simple

local tps = game:GetService("TeleportService")
local placeid = 966011451 -- change it to your game id

game:GetService("Players").PlayerAdded:Connect(function(plr)
      tps:Teleport(placeid,plr)
end)

do it in a server script

5 Likes

Thank you, i appreciate this very much because i had this problem.

It isn’t recommended to use TeleportService:Teleport() anymore, you should use TeleportService:TeleportAsync(). You can read the documentation here. I’d recommend using it because it has more useful features.

(Also, Please do not reply to a post if it’s over a year old. If you liked what they said, give them a like, but replying brings it back into new)

Ok, now i still have the problem, another problem is that i don’t know how to script.