I’m making a system where players can buy Vehicles for a one time fee, and then would save for other servers.
How would I go on about doing this? (EFFICIENTLY)
I’m making a system where players can buy Vehicles for a one time fee, and then would save for other servers.
How would I go on about doing this? (EFFICIENTLY)
Gamepass if there’s not tons of them.
If there’s a lot, dev product + datastore
Bought with Ingame money,
Data stores allow for data persistence within a game. Using data stores, associate each player with a dictionary of items they own structured like so:
local playerItems = {
Apple = true,
Pineapple = true,
Sword = true,
}
-- checking for item
if playerItems[itemName] then
print("player has item")
end
-- giving item
playerItems[itemName] = true
-- removing item
playerItems[itemName] = nil
This allows for item ownership setting and getting with a constant time complexity and is, in general, easier to use and understand.
There are several resources that teach you how to use data stores:
How are you currently storing the in-game money players collect? Saving what items the player owns would be implemented similarly. I would highly advise you to make a single data store key for each player that contains a table with all of their data, including their balance of in-game currency and their inventory of bought items. That way you can utilize the table to store whatever data you want to store.