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!
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!