I am trying to make a button in my Backrooms game that teleports you from the menu to Level 0, which is in a separate place but it won’t work. Here’s the script:
testplace = 11187756726
public = 12059003434
button = script.Parent
teleport = game["Teleport Service"]
teleport.SetTeleportGUI(game.ReplicatedStorage.ScreenGui)
button.MouseButton1Click:Connect(function()
teleport:Teleport(testplace)
end)
When I try it in-game though nothing happens, does anyone know what’s wrong?
2 Likes
teleport should be defind using the GetService Method, not with the “i wanna index a table” method.(tries to find “Teleport Service” in game)
teleport = game:GetService("TeleportService")
2 Likes
Ah so studio giving me that when I pressed tab was not a good thing.
1 Like
Give you what error? Invalid Syntax? Anything?
Try snapshotting the error
1 Like
No it gave me the game[“Teleport Service”] instead of game:GetService(“TeleportService”)
1 Like
Please snap the error here so I can have a closer look.
There is no error though, it just gave me the wrong piece of code.
Also the scrip is now
testplace = 11187756726
public = 12059003434
button = script.Parent
teleport = game:GetService("TeleportService")
teleport.SetTeleportGUI(game.ReplicatedStorage.ScreenGui)
button.MouseButton1Click:Connect(function()
teleport:Teleport(testplace)
end)
but it still won’t work.
1 Like
Refer to this function inside roblox docs
this may solve the issue.
1 Like
Well I don’t know how to set player to the player pressing the button
game.Players.LocalPlayer
Unless if you’re running from a server script
Still won’t work.
testplace = 11187756726
public = 12059003434
button = script.Parent
teleport = game:GetService("TeleportService")
teleport.SetTeleportGUI(game.ReplicatedStorage.ScreenGui)
player = game.Players.LocalPlayer
button.MouseButton1Click:Connect(function()
teleport:Teleport(testplace, player, nil, game.ReplicatedStorage.ScreenGui)
end)
Wait, is the place you want ppl to teleport to a sub-place? (Place in a place)
Not as far as I know. Is there a way to check?
try to use the creator dashboard to check your game’s places
also beware
This is what it looks like

Here. I found something interesting.
Actually I think the issue is with the button since it seems I can’t click it.
Have you made sure it’s a text button?
It’s an image button with a text label on it.
The problem might be with how you are trying to access the TeleportService.
Consider replacing teleport = game["Teleport Service"]
to teleport = game:GetService("TeleportService")
.
Also, teleport.SetTeleportGUI(game.ReplicatedStorage.ScreenGui)
isn’t required and can be removed, as this is no longer used in Roblox.
Finally, always ensure that the teleport function is running in a server script since TeleportService does not work on local scripts.
Here’s the updated script:
local testplace = 11187756726
local button = script.Parent
local teleport = game:GetService("TeleportService")
button.MouseButton1Click:Connect(function()
teleport:Teleport(testplace)
end)
Now, when you click the button, it’s supposed to teleport you to the “testplace”. If it still not working, make sure your “testplace” ID is the correct place id.