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

How do I fix this TeleportService function?

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)

2 comments

0

what is error

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

1 answer

✓ Accepted answer

When teleporting you need the actual player.

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

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