Hello i have a problem with my script when i teleport player to other place
This is my code:
game:GetService("ReplicatedStorage").Remote:WaitForChild("Start").OnServerEvent:connect(function(player,ServerName)
local PlayerTable = {}
for i , v in pairs (game:GetService("ReplicatedStorage").ServerStok:FindFirstChild(ServerName).Player:GetChildren()) do
wait()
if game.Players:FindFirstChild(v.Value) then
local teleport = game:GetService("ReplicatedStorage").Teleporting:Clone()
teleport.LocalScript.Disabled = false
teleport.Parent = game.Players:FindFirstChild(v.Value).PlayerGui
table.insert(PlayerTable,game.Players:FindFirstChild(v.Value))
end
end
local TP = game:GetService("TeleportService")
local ID = "11971945177"
print(ID)
local bruh = TP:ReserveServer(ID)
TP:TeleportToPrivateServer(ID,bruh,PlayerTable)
rs.ServerStok:WaitForChild(ServerName):Destroy()
end)
I tried some basic methods like setting the game to public or activating third party services, but none of them work.
Usually, when I get that error, the place is private, and it’s the place you’re teleporting to and not the place that you’re currently in. At least test if the place you’re teleporting to is published.
Maybe ID could be wrong? If the place your are tping to is within your game then you can use AssetService:GetGamePlaces().
Heres a sample code (Its also mentioned in documents)
local assetService = game:GetService("AssetService")
local places = assetService:GetGamePlacesAsync()
local place_ids = {}
for i,place in pairs(places) do
table.insert(place_ids,place.PlaceId)
end
If its a different issue then make sure:
Place is published
You are not testing it on studio
If the place is external (if its a different experience) then enable Third party teleports
(Game Settings > Security > Allow Third Party Teleports)