How to check if a variable is true for a random person in server?

I want an if statement that determines if someone random has a variable that is true, basically meaning if the variable is true for me, and it’s true for you, and the game randomly chooses you, XY and Z will happen.

Variable name is hasQueued.

local GetQueuedPlayers() 
	local buf = {}
	for i, v in pairs(game.Players:GetPlayers()) do
		local hasQueued = v:findFirstChild("hasQueued")
		if hasQueued.Value then
			table.insert(buf, v)
		end
	end
	return buf
end


local GetRandomQueuedPlayer()
	local Players = GetQueuedPlayers()
	return Players[math.random(1, #Players)]
end


GetRandomQueuedPlayer()