How to make a part that will teleport you in another place?

Hello guys, I am a high rank in some roleplay groups on Roblox, and I wan’t to make my own game so I don’t need to bring everyone to another cool game where the servers are maximum 5 players. So the thing I’m here for is to ask; to make a button or a part which will teleport you to another place is scripted or something else? Like you need to write a script in it? If yeah, can you guys please tell me what the script should look like? Thanks.

You can read about teleporting between places here: Teleporting Between Places | Roblox Creator Documentation

As for the button, you can look up ClickDetectors

1 Like

Alright, I will try, thankssssssssssssssssssssssssssssssssssssssssss

1 Like

You could do something like this:

Insert a ClickDetector into the button. Then insert this script into the button:

local PlaceID = 131280398 --Change this to your wanted placeID

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
	game:GetService("TeleportService"):Teleport(PlaceID, plr)
end)

Try not to ask for a script in this section in the future. I’m providing this because it’s a rather simpler script.

But yeah, do read the documentation in order to understand how this works.

1 Like

Is script for click detector must be local or normal?

1 Like

Add a click detector to a part and use a server-sided script to give it a function

What do you mean by server-sided script, I don’t realize

I did but it doesnt work.

The location:
image

Script1:

– this is not the one im talking about

Script2:

local PlaceID = 2916899287

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
game:GetService(“TeleportService”):Teleport(PlaceID, plr)
end)

1 Like

a normal script is a script that runs on the server :man_facepalming:, thus the name server-sided script. a local script is a client-sided script–it runs on the client.

Do you get any errors in the output?

Hi, so the script.Parent IS the ClickDetector, so do script.Parent instead of script.Parent.ClickDetector.

Second, you can only teleport in the real game, not Roblox Studio. So once you fix your script try publishing it and testing it on the game outside of Studio.

Also, don’t forget to enable third-party teleports in Game Settings>Security if you plan to teleport players to a different game.

Let me know if this works :slight_smile:

1 Like

You insert Script2 into “TeleportPart”, not clickdetector, or do what @FindPrin said.

2 Likes

It works, to be honest I don’t know which message should I mark as “Solution” but I will mark @furious_cucomber’s message.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.