I get "Attempt to teleport to place that is restricted" error even though I am the owner of the game

Hello, I am making a main menu for my game that teleports players to a different place when they click a mode, but I am getting an error. Whenever I test (not on studio) I get the error “Attempt to teleport to place that is restricted” even though I am the owner of the game.
Here is the code I am using:

Client (in a function for when the button is pressed, and tps is game:GetService(“TeleportService”))

tps:SetTeleportGui(script.Parent.Parent)
game.ReplicatedStorage.TP:FireServer()

Server:

local tps = game:GetService("TeleportService")

game.ReplicatedStorage.TP.OnServerEvent:Connect(function(plr)
	tps:TeleportAsync(9990616735, {plr})
end)

Info:

  • The place is in the same “universe” as the starting place
1 Like

Have you tried using TeleportToPlaceInstance such as:

local tps = game:GetService("TeleportService")
local placeId = 0 -- Enter the place id you're teleporting to
local gameId = 0 -- Enter the actual universe id, not the place id.
game.ReplicatedStorage.TP.OnServerEvent:Connect(function(plr)
	tps:TeleportToPlaceInstance(placeId, gameId, plr)
end)

I’m still getting the same error.

Try this:

local tps = game:GetService("TeleportService")
local placeId = 0 -- Enter the place id you're teleporting to
game.ReplicatedStorage.TP.OnServerEvent:Connect(function(plr)
	tps:Teleport(placeId, plr)
end)

Yeah I got the same error. But the place I am trying to teleport to is private, maybe that changes this?

I think it does. Change that place to public and try it.

Do I have to change the entire game to public or just the place?

I want to keep the game private until it’s ready…

Make it public and add a whitelist using:

game.Players.PlayerAdded:Connect(function(player)
if player.Name ~= 'YOUR NAME' then
player:Kick('You are not permitted to access this game.')
end
end)

This doesn’t apply to places within that universe.

I don’t feel like that is a very good way to do that… I am using team create and I want to keep it that way.

Maybe I will make this menu right before I release the game, but I really hope someone can find a solution.

If your game was created by or associated with a group you own, you can limit access to specific ranks within it; That’s what I’m doing with my game. In Game Settings > Permissions, you can expand the “game owner” section and set permissions for each rank. When I teleport between places in my game, I don’t get an error.


If it’s under your profile instead, I think you can limit access to friends only, keeping the game almost private.

2 Likes

That’s a good idea! I’ll get back to you when I’m done. It might take long because I don’t have any robux at the moment to create a group.

1 Like

I’m currently having this issue, did you find a solution?

just fixed this exact issue, all you need is to make the place you’re teleporting people in public/friends only, otherwise roblox will count it as restricted

It worked! Thank you so much! Although it was a bit of a pain porting everything and all the animations, but it was worth it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.