How to fix attempted to teleport to a place that is restricted error message?

Today, I was making a game shutdown auto-rejoin system which takes the player when an all servers shutdown occurred.

I made a script and placed it into a Workspace that teleports the player to another place. But, when I am going to test it, it returned with an error Attempted to teleport to a place that is restricted (Error Code 773). Is there a way to fix this problem and teleport all players into a teleport portal place?

This is the Script I placed in Workspace:

game:BindToClose(function()
print(2*2)
game.Players.PlayerAdded:connect(function(player)
local ShutdownGUI = player.PlayerGui.ShuttingDownGUI.Frame
ShutdownGUI.Visible = false
wait(3)
ShutdownGUI.Visible = true
end)
wait(5)
for _,v in pairs(game.Players:GetPlayers()) do
game:GetService('TeleportService'):Teleport(5029093005, v)
end
print("Done")
end)

I’m sure that the place is Public. I’ve also used TeleportToPrivateServer and `TeleportPartyAsync, and it’s still the same. If there is a solution, please post it into the comments section to let me know! I highly appreciated it and have a great day! :wink:

5 Likes

When using TeleportService, I believe you need to put the code in a LocalScript. In this case, you could achieve a similar effect to what you’re after using a RemoteEvent and firing it for all clients.

1 Like

I changed the script to LocalScript and placed it into Workspace, it does not do anything, it made the regular message: A game developer has shut down the server. Is there any other way to fix this?

Thanks for the reply btw!

LocalScripts don’t run in workspace

1 Like

Where is it should be? Thx for the reply btw!

LocalScripts can only run if it’s a descendant of a player’s PlayerGui, a player’s Backpack, a player’s PlayerScripts, player’s Character model, or the ReplicatedFirst Service.

2 Likes

Oh yeah. I have forgotten. Silly me. Thanks for the reply!

1 Like

I placed it into StarterPack, still, the same message as normal, The game's developer has temporarily shut down the game server. Please try again. Any other ways?

StarterPack? I remember LocalScripts not running there. Maybe put it in StarterGui or PlayerScripts?

Done it on StarterGui and PlayerScripts. The result are still the same.

Maybe use a server script for BindToClose and use a remoteEvent to show all the guis??

Something like this:

Server Script:

game:BindToClose(function()
    insertRemoteEvent:FireAllClients()
    wait(2)
    for i, player in pairs(game.Players:GetPlayers()) do
        TeleportService:Teleport(place_Id, player)
    end
end)

Client Script:

insertRemoteEvent.OnClientEvent:Connect(function()
    local gui = -- gui here
    gui.Visible = true
end)

I hope this works…

Still doesn’t work. I’m not sure if I’m not doing right, but this is the script I placed into ServerScriptService:

game:BindToClose(function()
RemoteEvent:FireAllClients()
wait(2)
for i, player in pairs(game.Players:GetPlayers()) do
    TeleportService:Teleport(5029093005, player)
end
end

I placed a RemoteEvent into ReplicatedStorage. Honestly, I don’t want the GUI because I have the GUI showed up at the teleported place. And sorry, I am new to scripting.

Umm… did you forget to put a ) at the end of the bindToClose function?

When I placed the ) to the end, it shows red lines: Screenshot by Lightshot

Oh, I forgot…

local RemoteEvent = game.ReplicatedStorage.RemoteEvent
local TeleportService = game:GetService("TeleportService")

Sorry I forgot to tell you that…

The error changed to: Attempted to teleport to a place that is restricted. Any solutions?

That, I honestly don’t know.

You do know the Add Place thing, right?

I think that you can Add the Place you want them to teleport there.

I used Add place thing in this. I can teleport before (2 week ago) but now it can’t…

To detect when a teleport fails, use the event: TeleportService.TeleportInitFailed.

Example:

TeleportService.TeleportInitFailed:Connect(function(player, TeleportResult, errorMessage)
   print("Teleport failed. Error Message: "..errorMessage)
end)

For more info, go to:

Developer Hub

https://gyazo.com/3a2ffb15fedb6caeca248f9493ddef79