Im trying to create a match system where once it begins, other players can't join. I've been looking for quite a while and there really isn't much info about using reserved servers for match making.
This is what I've gotten so far, but how would I create a new server once one starts.
~Local script
script.Parent.MouseButton1Click:connect(function() game.ReplicatedStorage.Events.Teleport:FireServer() end)
~Server side script
local TS = game:GetService("TeleportService") local Players = game:GetService("Players") local DSS = game:GetService("DataStoreService") local DS = DSS:GetGlobalDataStore() GameMode = fakeid24343 -- Get the saved code game.ReplicatedStorage.Events.Teleport.OnServerEvent:connect(function(plr) local code = DS:GetAsync("Test02") if type(code) ~= "string" then -- None saved, create one code = TS:ReserveServer(GameMode) DS:SetAsync("Test02",code) end game.ServerStorage.PlayerStats:WaitForChild(plr.Name).GameStats.ServerId.Value = code TS:TeleportToPrivateServer(GameMode,code,{plr}) end)
So put this in the local script
local plr = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() game.ReplicatedStorage.Events.Teleport:FireServer(plr) end)