local ServersCreated = {
["ServerIndex"] = {}
}
local CurrServers = 0
function game.ReplicatedStorage.Remotes.CreateServer.OnServerInvoke(plr, CreationData)
if not table.find(ServersCreated, CreationData[1]) then
local code = game:GetService("TeleportService"):ReserveServer(13414792758)
CurrServers += 1
local mugroobeer={Display=CreationData[1],Region=CreationData[2],Server=code,ServerID=CurrServers}
table.insert(ServersCreated["ServerIndex"], mugroobeer)
ServersCreated["ServerIndex"][CreationData[1]] = ServersCreated["ServerIndex"][1]
ServersCreated["ServerIndex"][1] = nil
for _, player in pairs(game:GetService("Players"):GetPlayers()) do
local Template = script.Template:Clone()
Template.ImageLabel.Image = "https://www.roblox.com/headshot-thumbnail/image?userId="..CreationData[3].."&width=420&height=420&format=png"
Template.Region.Text = CreationData[2]
Template.ServerName.Text = CreationData[1]
Template.Play.MouseButton1Click:Connect(function()
if game.PlaceId == 13414792758 then
game:GetService("TeleportService"):TeleportToPrivateServer(13392833049, ServersCreated["ServerIndex"][ServerData[1]][3], {player})
else
game:GetService("TeleportService"):TeleportToPrivateServer(13414792758, ServersCreated["ServerIndex"][ServerData[1]][3], {player})
end
end)
Template.Name = CreationData[1]
Template.Parent = player.PlayerGui.Main.ServerList.ScrollingFrame
end
end
end