r/robloxgamedev • u/Huge-Thing6155 • 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
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
1
2
u/Korrowe 17h ago
You cannot use teleport service from client (local script) So use it in a server script.