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

Universe teleport GUI, I have the GUI, but can't figure out the script. Help?

Asked by 10 years ago

I want to provide a menu UI to provide users an easy, streamlined method of transportation between games in my universe, and have it all created and laid out... Except for the place teleport code. I know it needs to call a local onclick() get.Parent and teleportservice but am unsure on how to create it to make it functional. Can anyone help?

2 answers

Log in to vote
2
Answered by 10 years ago

Teleports are controller with one simple service, TeleportService! The most important part of this service would be the Teleport method. Here's an example of how to do it when a button is clicked:

local placeId = 0 -- Change this to the ID of the place
local button = script.Parent -- Change this to wherever the button that will be clicked is

button.MouseButton1Click:connect(function() -- When the button is clicked
    game:GetService("TeleportService"):Teleport(placeId) -- Teleport them!
end)
1
Thanks a ton! Got it to work with a few modifications to make it go to the UI buttons, but nothing too hard. areiydenfan00 115 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.
Button.MouseButton1Click:connect(function()
    game:GetService("TeleportService"):Teleport(Game ID, Player)
end)

Answer this question