Making a UI textbutton for being teleported

Heya! So, I am making a main menu UI, witch when you press a TextButton, you should be teleported to another game, where the player could start playing in-game. Here’s the script I’ve made and the explorer screenshot too:

local teleportButton = script.Parent 
local function teleportPlayer() 
	local player = game.Players.LocalPlayer 
	player:LoadCharacter() 
	game:GetService("TeleportService"):Teleport(player, 123456789) -- I've set here for showing script a sample universe ID.
end
teleportButton.MouseButton1Click:Connect(teleportPlayer)

Here’s the explorer screenshot:


“play” is the TextButton, & the inside Local Script is where I’ve made the script for the teleporter, but didn’t work. I would really apreciate if someone could help me on this!

1 Like

after a quick look through a documentation, I found this:

maybe try removing the player argument from the teleport line?

I think you do need it, just checked it through a script i made a day ago
image

ohh, that’s their issue. They’ve got it the wrong way round.

And Some things you need to do:

You have to allow this
image

And the place ur teleporting to must be published AND you have to play it in game, you can’t use teleport service in studio

Yeah, that’s allowed but script it’s still not working and I’ve been trying directly trough the Roblox Game.