Is it possible to detect first certain number of players (like 100) who joined your experience? (GLOBALLY)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want to learn more about this since ill rely some features in my experience around it

  2. What is the issue? I have no idea how to do it, I’m thinking of a data store but how do I detect if that player is the first 100 players to join

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? I did try and didn’t find anything about it

1 Like

Do you mean first 100 ever, or the first 100 in each session?

globally, ugh i hate this limited characters

Yea, the character limit is awful.

You could create a datastore (I’m not going to explain datastores entirely). You could have a table of players, each time a player joins, pull that table from the datastore and check the amount of values, then if the value is under 100, add the player to the table. If it’s over 100, just leave it alone.

This is inefficient, and there may be a better way, but most likely you can leave this system in place for a little bit, and then once the table fills up, remove it form the game and just store the player’s names/userID’s somewhere so that you could give them rewards in the future (or whatever you plan to do)

oh, I see, I don’t know a lot about data stores, but uhhh how do you save a table-? in a datastore-? aha-

i knoww how to save a players data-

You would create a table, like this:

local newTable = {}

and then save it to a datastore like so:

datastore:SetAsync(key, newTable)
1 Like
local dss = game:GetService("DataStoreService")
local pls = game:GetService("Players")

local list = dss:GetDataStore("balls")

local playerAdd = function(player)
  local data = list:GetAsync("List") or {}
  if (((#data) < 100) and (not (table.find(data, player.UserId)))) {
    data[#data+1] = player.UserID -- storing the userid
    repeat local suc = pcall(function()list:SetAsync("List", data)end) task.wait() until suc
  }
end

table.foreach(pls:GetPlayers(),function(i,v)playerAdd(v)end)

pls.PlayerAdded:Connect(playerAdd)
1 Like

oh I see, I don’t think I can put two solutions in a post, but thanks to you both!