How do i make a unique gui that popups for the first 50 people to get a badge?

Hello Developers,

I Want to make a system where the first 50 people to complete and get a badge get a unique gui popup with a unique code for each player?

Im currently working on it but am struggling, any help or advice ?

maybe try using tables, datastores, and remote events?

by that i mean you could set up a data store to store the information about players who have completed the task and received the unique code.

when the player completes a task, notify the server that the task has been completed. if there is less than 50 players, insert them into a table of players who have completed the task. if there are 50 players in the table. then notify that player that all 50 spots have been taken up. this table can be saved with the data store.

you can use that same data store to persist data across different game servers and sessions. then you could generate unique codes for the first 50 players who complete the task. you can use a function like this:

local function generateUniqueCode()
    -- generate a unique code logic here (e.g., random string generation)
end

then use a remote to notify the client when they have completed the task and to send them the unique code.

when a player completes the task, check if they are among the first 50 players.

if they are, generate a unique code, store it in the data store, and fire the remote event to notify the client.

on the client-side, you can listen for the event and show the unique code in a gui popup.

this setup will ensure that when a player completes the task, their unique code is generated, stored in the data store, and then sent to the client using a remote event. the player will receive a gui popup with their unique code only if they are among the first 50 to complete the task.

this is a VERY long one. except I am suggesting that you use a off platform database, that will display how many people it was given too and who they are. From there you could most definitely manually write a script that checks through a list of userids and does it that way. I’d reccomend a hosting service like 000webhost https://www.000webhost.com
I have made a post in the past about a ban system, and if you have basic knowledge or you could just watch a couple tutorials, you can change around the parameters to only store the IDs. How to fix "Couldn't Parse JSON" and how to use SQL database in roblox Hope this helps! if you need any pointers you can just message me!