I am using a touchable teleporter right now, but I am wondering if anybody could help me with making a “Clickable Teleporter” that brings you to another game? (By the way, I am a beginner and I have tried to find this out but it seems like i cannot find anything about it)
If you are looking for a clickable part teleporter, use ClickDetectors.
If you are looking for a UI click teleporter. You would listen for inputs on the UI using the InputBegan event and use a RemoteEvent to fire server for teleportation.
Here’s a good tutorial, that explains you how to use the teleport service to teleport players between games/places:
Your script should look something like this:
If you want the player to get teleported when touching a part:
local TeleportService = game:GetService("TeleportService")
local PlaceID = 0000 -- Your game/Place Id here
local function onPartTouch(otherPart)
local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
if player then
TeleportService:Teleport(PlaceID, player)
end
end
script.Parent.Touched:Connect(onPartTouch)
If you’re using click detectors:
local TeleportService = game:GetService("TeleportService")
local PlaceID = 0000 -- Your game/Place Id here
local ClickDetector = script.Parent.ClickDetector
local function onMouseClick(player)
TeleportService:Teleport(PlaceID, player)
end
ClickDetector.MouseClick:connect(onMouseClick)
Does it matter if I use LocalScript Or Script because I can’t get it working.
Only works in a Server Script (the normal one)
It seems to not be working, but do I put the script inside the ClickDetector or the Part?
Ohhh, i needed to put the script in the Part not the ClickDetector… Thanks a lot!