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

How do I fix this TeleportService function?

Asked by
imaA6D 39
4 years ago

Basically I made a GUI with a button named "Play" and when you press it you get transferred to another game. But its not working. Any help?

script.Parent.MouseButton1Click(function()
local gameID = 4725259427
game:GetService("TeleportService"):Teleport(gameID)
end)
0
what is error royaltoe 5144 — 4y
0
if you dont have an error print("hi") inside of the mouse click function if nothing prints, print at the top of the script if nothing prints there then your script isnt somewhere it can run royaltoe 5144 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

When teleporting you need the actual player.

script.Parent.MouseButton1Click(function()
    local gameID = 4725259427
    game:GetService("TeleportService"):Teleport(gameID, put_player_id_here)
end)

Ad

Answer this question