I’m trying to make a game where players are able to purchase/rent property (businesses, homes, etc.) however I want it to function over a long period of time. For example, if I buy a store, I want to be able to rent it for let’s just say 2 days where no one else can purchase it. Is this possible? If so how can I go about saving stuff for a game? I tried looking it up but could only find posts about saving data for players.
You could save a string (e.g. you save a “Store Model NoobStore” string variable) and if you need to load the store, just check what you have as a store and load that store (yes, sounds confusing, in other words:
if StoreModel == "NoobStore" then
--load the NoobStore
end
). But if you can customize the loading like BloxBurg itself, then you better choose serialization.
But can’t you save a whole game directly instead of making such a complicated detour? No, you cannot. Or you learn decent programming, or not.
Hope this helps
It does but the issue with that it would neglect other active servers right? Like is there a way to universally do something so that way it cross-interacts with other servers too to make sure two people don’t purchase the same store on different servers.
You just have to retrieve the DataStore with the same key:
local Data = DS:GetAsync("GlobalKey")
The key is where your data is stored, in this case, GlobalKey
will be a datastore for all players. The reason we have keys is because we need to differentiate between 2 players data. For example, if you saved data with UserId
s, and you load let’s say, your UserId to Player1, then player one will be able to see your data. Same thing for this, if you load with the same key, you get the same data.
I’m tad confused by that. But in the end it’s possible to have stores have a value distinguishing who owns it and update it live time across multiple servers correct?
Yes, if you were to save the data in "GlobalKey"
, and you load "GlobalKey"
to every player, every player would be able to see the data in it(meaning that they can see if it is owned or not.