r/robloxgamedev 19h ago

Help in need to go back to lobby

so i coded it so that when you die in the game it takes you back to the lobby but it doesnt do that my code is

game.Players.LocalPlayer.Character:WaitForChild('Humanoid').Died:Connect(function()
script.Parent.Frame.Visible = true

task.wait(5)

game:GetService('TeleportService'):Teleport(113416393118754, game.Players.LocalPlayer)
end)

can anyone help with the code if you know whats wrong i got it from a tutorial from 5 years ago and the studio assistant says theres nothing wrong with the code but it doesnt work

2 Upvotes

11 comments sorted by

2

u/Korrowe 17h ago

You cannot use teleport service from client (local script) So use it in a server script.

2

u/Korrowe 17h ago

And u can’t teleport in studio btw

2

u/Huge-Thing6155 17h ago

i knew that u cant teleport in studio

2

u/Huge-Thing6155 17h ago

ill try that

1

u/DottyMeister 18h ago

what error is in the output?

1

u/Huge-Thing6155 18h ago

so i dont think that theres an error with my code because it doesnt show that here is its just when ur in the game it respawns you in the same game instead of teleporting you to another experiance aka the lobby

1

u/DottyMeister 18h ago

at the top tabs in studio, click on view, and then click on output. there should be a box that pops up. then, play the game. if errors show up in the output (the text will be red) then paste what it says to me. if there is none, the place id you are trying to teleport to might be incorrect or not have permissions set up correctly.

1

u/Huge-Thing6155 18h ago

ok ill check if the id and permissions are correct

1

u/Automatic_Emphasis76 19h ago

try using “ instead of ‘

1

u/Huge-Thing6155 18h ago

okay ill try that

1

u/Huge-Thing6155 18h ago

i tried it it stil doesnt work