I’m currently reading ReservedServer, and I would like to understand the last part of following code sample from the article.
Code Sample
local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
local DSS = game:GetService("DataStoreService")
local DS = DSS:GetGlobalDataStore()
-- Get the saved code
local code = DS:GetAsync("ReservedServer")
if type(code) ~= "string" then -- None saved, create one
code = TS:ReserveServer(game.PlaceId)
DS:SetAsync("ReservedServer",code)
end
local function Joined(plr)
-- Everytime they chat, we want to know
plr.Chatted:Connect(function(msg)
if msg == "reserved" then -- Aha, that's our cue
TS:TeleportToPrivateServer(game.PlaceId,code,{plr})
end
end)
end
-- Connect all current and future players
Players.PlayerAdded:Connect(Joined)
for k,v in pairs(Players:GetPlayers()) do
Joined(v)
end
I want to understand the last part of the code where;
-- Connect all current and future players
Players.PlayerAdded:Connect(Joined)
for k,v in pairs(Players:GetPlayers()) do
Joined(v)
end
Comment says all current and future players will be teleported, where it also says that when all players are teleported to Reserved Server the current server will be shut down, then how come the new joining player will be able to join the reserved server.
Question
If GlobalDataStore
is being used then is that GlobalDataStore
available throughout the current game.
Question
If GlobalDataStore
is available throughout the game then all coming players will join the Reserved Server then what will happen when Reserved Server is full.
Question
Does Reserved Server support multiple places at a single time…
Thanks in advance…