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”))
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)
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)
game.Players.PlayerAdded:Connect(function(player)
if player.Name ~= 'YOUR NAME' then
player:Kick('You are not permitted to access this game.')
end
end)
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.
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