How to create a hosting board?


So I am creating this RP theatre group and I need to have this “hosting board” where you can get added onto the hosting waiting list and it goes down the list while the server is up. How could I do this? I was wondering could I use a table and put the people usernames who click it into the table and do it that way or would there be a better way you suggest.

1 Like

I can’t tell by your description if your need requires a DataStore or not (saving the reservation list in case the server shuts down after all players leave)
If it does need to save that information, I would recommend using an Ordered Data Store
and when adding a player to the “list”, just use their name or UserId as the key, and os.time() as the value and you’ll have a nice list in the order of when players were added to it.

If it doesn’t have to be saved, a simple lua table {} in a normal Script or ModuleScript can keep track of your data.

local reservationData = {}

local function addToList(player)
   table.insert(reservationData, player)  --inserts player at the end of the reservation data list

local function getNextInList(player)
    return table.remove(reservationData, 1)  --if there is at least 1 item in list, this will remove it and return it, otherwise it will return nil

local function printList()
    for i,player in pairs(reservationData) do

It only needs to be for that one server so no does not need to use DataStore. Yea that is what I thought with the table I was just unsure if there was a better way to do this.

There’s always a better way to do something in scripting. I suggest you follow the steps you got right now, keep continuing to find the most efficient code, and there you go.