I’ve been experimenting with teleportservice for a while now, and I’ve ran into an issue,
imagine this:
You create a reserved server code with the teleportservice,
You save it inside a datastore
After a day or so, you wanna
join the reserved server with that code that you saved inside your datastore
But it generates a new code upon teleporting and loading into the place
I’ve read a topic that tells reserved codes never get deleted but the servers will go offline
Now I need a fix
Here’s my code for joining the world:
script.Parent.MouseButton1Up:Connect(function()
script.LocalScript.Disabled = false
local options = Instance.new("TeleportOptions")
options.ReservedServerAccessCode = script.Parent.Code.Value <--- already checked here and its correct but it generates another code at the next code block
options.ShouldReserveServer = false
TeleportService:TeleportAsync(14424657227, {script.Parent.Parent.Parent.Parent.Parent.Parent.Parent}, options)
end)
And here’s my code in the place that players will get teleported:
wait(10)
local DSS = game:GetService("DataStoreService")
local DS = DSS:GetDataStore("WorldsSaveSystem_V1")
local save = DS:GetAsync("Worlds")
print(game.PrivateServerId) <--- here it prints a different code
for i, v in pairs(save) do
if v["Code"] == game.PrivateServerId then
for _, a in pairs(v["Blocks"]) do
if a["BlockType"] == "SpawnLocation" then
local part = Instance.new("SpawnLocation", workspace)
part.Anchored = true
part.Size = Vector3.new(tonumber(string.split(a["BlockSize"], ",")[1]), tonumber(string.split(a["BlockSize"], ",")[2]), tonumber(string.split(a["BlockSize"], ",")[3]))
part.Position = Vector3.new(tonumber(string.split(a["BlockPos"], ",")[1]), tonumber(string.split(a["BlockPos"], ",")[2]), tonumber(string.split(a["BlockPos"], ",")[3]))
part.TopSurface = Enum.SurfaceType.Smooth
part.BottomSurface = Enum.SurfaceType.Smooth
end
end
end
end
for i, v in pairs(game.Players:GetChildren()) do
v:LoadCharacter()
end
Thanks!