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

How do I teleport between places when I press a textbutton?

Asked by 6 years ago

I want to teleport to another place after pressing a textbutton I have in my StarterGui. How do I do it?

I tried placing a local script inside the textbutton like this:

PlaceId = '1392880606' Game.Players.PlayerAdded:connect(function(player) wait(2) if not player.Character then player:LoadCharacter() end Game:GetService('TeleportService'):Teleport(PlaceId,player.Character)

end)

Please anyone knows what can I do?

1 answer

Log in to vote
0
Answered by 6 years ago
local TeleportService = game:GetService("TeleportService")

local Place = 123456789 -- Put place Id here

local player = game.Players.LocalPlayer



script.Parent.MouseButton1Click:connect(function()

TeleportService:Teleport(Place, player)

end)

Put this script inside you're textbutton

0
It doesn't work FrikiGameplaysHD 1 — 6y
0
If it does not work ensure that the game is published and active OldViking013 0 — 6y
0
Oh right FrikiGameplaysHD 1 — 6y
0
Did it work? OldViking013 0 — 6y
View all comments (2 more)
0
I'm still doing it FrikiGameplaysHD 1 — 6y
0
It didn't work and the place is activated FrikiGameplaysHD 1 — 6y
Ad

Answer this question