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

How can I make a TextButton teleport a player to another place?

I'm trying to make it so when the player presses the TextButton, they would be teleported to a different place which is a side place of my game. However, it is obviously not working since I suck at coding. I checked Roblox Wiki and this is the best that I can do:

local PortalGui = script.Parent
local PortalFrame = PortalGui.PortalFrame
local PortalScrollingFrame = PortalFrame.PortalScrollingFrame

local TeleportService = game:GetService("TeleportService")
local World1ID = 1114619171
local Test = PortalScrollingFrame.TextButton

Test.MouseButton1Down:connect(function(player)
	TeleportService:Teleport(World1ID, player)
end)

This is the Roblox Wiki that I used.

Any help is appreciated!

1 answer

What you have should work, however, replace FindService with GetService. If you use FindService and the service TeleportService doesn't already exist, it'll return nil, whereas GetService will create that service and return it.

I'd also imagine you'd have to actually be in a server for it to work (don't quote me on that though).

Hopefully that small fix resolved the issue for you!

1 comment

0

It didn't really fix it, though nice try!

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