Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make a TextButton teleport the player?

How are you able to make a TextButton teleport the player to a different game? This is what i've tried from a different one:

local button = script.Parent
button.Visible=true

local teleportService = game:GetService("TeleportService")

Test.MouseButton1Down:connect(function(player)
teleportService:Teleport(4674197557)
end)

Anything helps! Thanks!

2 comments

0

Where did this Test come from? The MouseButton1Down is in your button, also you are using connect, which is deprecated. Use Connect instead.

0

Any errors?

1 answer

✓ Accepted answer

As you want to teleport a player you use teleport service https://developer.roblox.com/en-us/api-reference/function/TeleportService/Teleport

local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
 
local placeId = 4674197557 -- replace here
local userId = game.Players.LocalPlayer.UserId
 
-- find the player
local player = game.Players.LocalPlayer
 
-- teleport the player
script.Parent.MouseButton1Click:Connect(function()
TeleportService:Teleport(placeId, player)
end)

5 comments

0

Please Accept My Answer If It Worked

0

well it did work but it keeps saying the place doesnt exist

0

change placeId to the id of the place you want it to tp to

0

still

0

as i am now unsuspended i can answer try it now sorry it took long

This discussion is preserved as it was. New answers, comments, and votes are closed.