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

I need help with making a working teleport Gui that takes you from game to game?

Asked by 6 years ago

I have tried a lot but I still cant get a working Teleport GUI, and by that I mean one that teleports you to different places. Here is what I tried

local TeleportService = game:GetService("TeleportService")
local gameID = 1559604744


script.Parent.MouseButton1Click:connect(function()
    print("HI")
    if player then
        TeleportService:Teleport(gameID, player)
end)

please help me and thanks

1 answer

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

Hello, turbomegapower12345!

I know why your script isn't working, It must be a Local Script and must have a variable that reffers to player!

Example of working one:

local TeleportService = game:GetService("TeleportService")
local gameID = 1559604744
local player = game.Players.LocalPlayer


script.Parent.MouseButton1Click:connect(function()
    if player then
            TeleportService:Teleport(gameID, player)
    end
end)

This don't will teleport if you're in studio, must be a server!

Good Luck with your games!

0
Oh, thanks so much, I have one more question. Does it have to be in Starter Player Scripts? turbomegapower12345 48 — 6y
0
No, it have to be on the gui you want the player to click Leamir 3138 — 6y
Ad

Answer this question