How would I be able to save 2 different sets of data and load them in with a gui button click?
Can you be more specific on what exactly you are asking about? I’m assuming you are referring to data stores when you say “save data”. For that something like this should work:
button.MouseButton1Down:connect(function() -- replace button with a pointer to your gui button local player = nil -- replace nil with whatever code you need to use to get the player who clicked the button local dataStore1 = game:GetService("DataStoreService"):GetDataStore("your name here") local dataStore2 = game:GetService("DataStoreService"):GetDataStore("your other name here") local data1 = dataStore1:GetAsync(player.UserId) local data2 = dataStore2:GetAsync(player.UserId) -- do what you need to do with the player data. end)
Ik, im just saying like, if I were to make 2 guis, could I load in a datastore with a button click, and then unload the other if they decide to go back?
You can’t “load” and “unload” data stores, but you can remove values from a data store by setting them to nil.
Let me look into this and see if I can come up with a solutiuon.
In the future you might want to make sure you answer the questions in About the Scripting Support category so that way people know you are talking about when you ask for help, and can help you easier.
Ontop of what robert has said, you can use on a datastore:
:IncrementAsync() to change values.
However if you wanted to remove an index from a DataStore you can use:
There’s also 2 articles on the dev dub for extra support:
Hope you recognise DataStores can’t used on the client and how terrible this is going to be in the long run for your request budget.
You can just save several tables inside one table and then iterate through them when the button is clicked.
I forgot about that, my fault for being stupid.
No need to beat yourself up like that. You aren’t stupid for not knowing or for forgetting something. I’m not going to go on a words-of-encouragement rant but the DevForum is a (relatively) good learning resource in it’s entirety and all. Can’t be stupid for a small mistake.