Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do you make a TextButton teleport the player?

Asked by 4 years ago

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!

0
Where did this `Test` come from? The MouseButton1Down is in your button, also you are using `connect`, which is deprecated. Use `Connect` instead. iiAmBetterThanYouHa 20 — 4y
0
Any errors? compUcomp 417 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)
0
Please Accept My Answer If It Worked EnzoTDZ_YT 275 — 4y
0
well it did work but it keeps saying the place doesnt exist LinkZelda_Sage 16 — 4y
0
change placeId to the id of the place you want it to tp to EnzoTDZ_YT 275 — 4y
0
still LinkZelda_Sage 16 — 4y
0
as i am now unsuspended i can answer try it now sorry it took long EnzoTDZ_YT 275 — 4y
Ad

Answer this question