You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I’m trying to create a system similar to Piggy Build Mode where it reserves a server for players. -
What is the issue? Include screenshots / videos if possible!
I can’t access the reserved server whether I use TeleportToPrivateServer or TeleportAsync. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried looking at every post I found. None of theme fixed the issue.
It is the same universe, and I even tried turning on 3rd party teleports.
If it helps, here is my code.
local TeleportService = game:GetService("TeleportService")
game:GetService("ReplicatedStorage"):WaitForChild("Events"):WaitForChild("BuildEvent").OnServerEvent:Connect(function(player, data)
if data.Type == "Teleport" then
local code = game:GetService("DataStoreService"):GetDataStore("BuildServerStore"):GetAsync(data.OwnerId)
print(code)
if code == nil then
code = TeleportService:ReserveServer(game.PlaceId)
game:GetService("DataStoreService"):GetDataStore("BuildServerStore"):SetAsync(data.OwnerId,code)
end
local teleportOptions = Instance.new("TeleportOptions")
teleportOptions.ReservedServerAccessCode = code
teleportOptions:SetTeleportData({Owner = data.OwnerId})
TeleportService:TeleportAsync(11369903874, {player}, teleportOptions)
end
end)