Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i make a global(across ALL servers) queue?

I'm trying to make a minigames queue for my game (a part of the game), and I want players all over different servers be able to queue and get in the minigame, but, I'm worried if I only make the queue server only, players would need to wait a very long time to get enough players. So, I want to make a queue for all servers in the game.

1 comment

0

lemme edit my answeer below to see if i can accommodate for what you want

1 answer

you could use http service, the easiest way..

or you could get creative with datastore service.

in order to use HTTP service, you need an external server/website.. and you could make servers constantly request and update the information on your web server;

in this example whoever, I'll try to get creative with data-store service,

lets say for example that i am making a thing that displays the name of the player with the most money in the game....

local data_name = "playerWith_MostMoneyInThisWonderFullgame"
local global_key = "theRichestPlayerKnown"
local money_key = "MostMoneyyyyy"
local datastore = game:GetService("DataStoreService"):GetDataStore(data_name)
local players = game.Players

local surfaceUi = workspace.board.surfaceGui.textlabel

local function newRichestPlayer(player)
	if player then
		local money = player.leaderstats.Money
		pcall(function()
			datastore:SetAsync(global_key,player.Name)
			datastore:SetAsync(money_key,money)
		end)
		
		surfaceUi.Text = player.Name.."\n"..money
		
	end
end



players.PlayerAdded:Connect(function(player)
	local playerWithMostMoney;
	local money
	
	pcall(function()
		playerWithMostMoney = datastore:GetAsync(global_key)
		money =datastore:GetAsync(money_key)
	end)

	if playerWithMostMoney then
		if player.leaderstats.Money.Value > money then
			newRichestPlayer(player)
		else
			surfaceUi.Text = playerWithMostMoney.."\n"..money 
		end
	else
		print("there is currently no known richest player")
		surfaceUi.Text = "unknown"
	end
	
end)


local co = coroutine.wrap(function()
	while wait(2) do
		local playerWithMostMoney;
		local money
		
		pcall(function()
			playerWithMostMoney = datastore:GetAsync(global_key)
			money =datastore:GetAsync(money_key)
		end)

		for _, player in pairs(players:GetChildren()) do

			if playerWithMostMoney then
				if player.leaderstats.Money.Value > money then
					newRichestPlayer(player)
				end
			else
				print("there is currently no known richest player")
				surfaceUi.Text = "unknown"
			end

		end
	end
end)

co()

sorry this is not in the best form, i am kinda of in a hurry

2 comments

0

can you explain more about how to use it?

0

there

This discussion is preserved as it was. New answers, comments, and votes are closed.