How to make a Air miles system for an airport? How do you create logs for the purchase using points?

Hey guys, so I recently started an airline and I have bought a Air Miles system to use in an airport. But that design is not good and doesn’t look nice. So how do you make a simple, yet effective one? I’m a pretty bad scripted, your help will be appreciated.

1 Like

Your question is rather broad. You mention wanting an effective design purchase system; but your topic is logging purchases? Please elaborate and go more in depth on what you want done or need help with haha. :smile:

So what I want is both actually, like a person buys a upgrade with the points ingame, then he will ask for getting upgraded. For proof, HRs should be able to view the logs in discord or ingame to see if he is lying.

Okay! Firstly though, Discord isn’t meant for logging so we should not abuse their socialising services. To do this you can use DataStores. So whenever somebody purchases points:

local DSS = game:GetService("DataStoreService")
local PointsStore = DSS:GetDataStore("points") --The DataStore name.
local PurchasedPoints = --Reference this based on the number of points the player purchased.
local Player = --Reference the player too.
local ID = game.Players:GetNameFromUserIdAsync(Player)

WhenTheyPurchasePoints function() --Assign this function first of course.
    local yes,no = pcall(function()
        PointsStore:IncrementAsync(ID,PurchasedPoints)
    end)
    if yes then
        print("Purchased points.") --Do not actually use print, do something else to let the player know that they have purchased their points.
    end
    if no then
        print("Failed to access DataStore.") --Let the player know that they did not manage to purchase the points and do not charge their account.
    end
end

So that would be the player purchasing points. For HR to check their points, we will be retrieving their points from the DataStore. You can use GUIs or anything you wish to use, but I will just use a simple example with admin commands:

local DSS = game:GetService("DataStoreService")
local PointsStore = DSS:GetDataStore("points")

game.Players.PlayerAdded:Connect(function(player)
    if player:GetRankInGroup() => 0 then --Insert your group's ID and the number should be the minimum admin rank. Only they can run this command.
        player.Chatted:Connect(function(chat) --If they chat then this function will run.
            local fullcommand = string.split(chat," ") --Split the message into a table of the command and the player.
            local PlayerToCheck
            pcall(function() PlayerToCheck = game.Players:GetUserIdFromNameAsync(fullcommand[2]) end)
            if fullcommand[1] == "/check" and PlayerToCheck ~= nil then
                local PointCount = PointsStore:GetAsync(PlayerToCheck)
            print(PointCount) --This is the player's points, but don't actually print it; display it in the HR's Gui or something to show them the value.
            end
        end)
    end
end)

Sorry if I messed some stuff up, I’m currently on mobile and it’s 4am lol. I didn’t add notes to every single line so that you will learn, but if you have any questions let me know.

I’ll try it and get back! Thanks for your help!

1 Like

No worries! Also please note that it isn’t the full script since I do not know your entire game, so you would have to change a lot of it according to your game. And a few more lines may have to be wrapped in pcall()s as DataStores occasionally error. :slight_smile: