How to make it when you touch a part you join a game

like when you touch a part you join a game and you can’t join from your profile you have to touch that BUT how?

1 Like

I think you’re looking for Teleport Service here’s a tutorial
(22) Advanced Roblox Scripting Tutorial #25 - Teleport Service (Beginner to Pro 2020) - YouTube

and are you actually over 13?
I feel like this guy is like 10

1 Like

Thanks for the info i’ll try that!

You can Use TeleportService to Teleport the Player.

local TeleportService = game:GetService("TeleportService")
local GameId = 0000000 -- Change to Game Id

local Part = script.Parent
local Bounce = false

Part.Touched:Connect(function(Hit)
  if Bounce == false and Hit.Parent:FindFirstChild("Humanoid") then
     local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
     if Player then
        Bounce = true
        TeleportService:Teleport(Player,GameId)
        wait(1)
        Bounce = false
     end
  end
end)

This should be a Script in The Part

1 Like

besides that tutorial you also have these two links
https://developer.roblox.com/en-us/api-reference/class/TeleportService

Thank you but how would you make the game unplayable unless you walk on that?

Spawn the Player Directly
on the part.

This will teleport the player as soon as he joins

what do you mean unplayable ?
is it like you can’t walk or click?

Y’know when you try and join your friend in a roblox game but it just links back to the main game? Thats what im trying to do.

set it to private

so that only players that get sent there manually can get into the place

How would i make it if you did try and join it links back to the game they got teleported from?

it automaticly does that

so ur good!

Alright thank you for that information i’ll try the stuff you send!

local TeleportService = game:GetService("TeleportService")
local GameId = 0000000 -- Change to Game Id

local Part = script.Parent
local Bounce = false

Part.Touched:Connect(function(Hit)
	if Bounce == false and Hit.Parent:FindFirstChild("Humanoid") then
		local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
		local GamePlace = tpService:ReserveServer(GameId)
		if Player then
			Bounce = true
			tpService:TeleportToPrivateServer(GameId, GamePlace, Player)
			wait(1)
			Bounce = false
		end
	end
end)

This will Teleport them to a private server,
Hence no one will be able to Join them.

Also, If your Problem is solved,
Can you mark an Answer as Solution?

That does not work i tried it and it says unable to cast value to object

What Line?
And Did you replace the GameId With the Teleport Place Game ID?

your arguments were wrong…

1 Like

It did not automatically do it. First, I had to make a place in that game. Then, I had to copy the whole entire game over to that. Because when I made the game private it just prevented players from joining.