Is there any way to have player data save in files? Like you can select an empty file to begin saving your new stats by starting a new game or you can press on 'Load' and click on your previous game file to continue where you left off?
You'll just have to name the DataStore a different name, like this:
local SaveFileOne = game:GetService('DataStoreService'):GetDataStore("savefile1") local SaveFileTwo = game:GetService('DataStoreService'):GetDataStore("savefile2")
And do the tasks like you did the first one
SaveFileTwo:GetAsync(playerkey) SaveFileTwo:SetAsync(playerkey,datatable)
EDIT:
If you want someone to have 2 save files:
Clicking the "Load Save File 1" Gui that you've made LOCAL SCRIPT:
local button = --where your button is button.MouseButton1Click:Connect(function() local EventOne = game:GetService("ReplicatedStorage").EventOne -make a "Remote Event" and put it in ReplicatedStorage. You can name it anything, i named it EventOne. EventOne:FireServer() --the local script tells the server that the button was clicked end)
SERVER SCRIPT: Do your GetAsync here for the first save file.
local SaveFileOne = game:GetService('DataStoreService'):GetDataStore("SaveFile1") local EventOne = game:GetService("ReplicatedStorage").EventOne EventOne.OnServerEvent:Connect(function(player) --fires when EventOne was fired to the server. local playerkey = "player-"..player.userId local SaveFiles = SaveFileOne:GetAsync(playerkey) --the save files you want them to recover end)
Clicking "Load Save File 2" gui that you made
LOCAL SCRIPT:
local button = --where your button is button.MouseButton1Click:Connect(function() local EventTwo = game:GetService("ReplicatedStorage").EventTwo -make another remote event EventTwo:FireServer() end)
SERVER SCRIPT:
Do your GetAsync here for the second save file.
local SaveFileTwo = game:GetService('DataStoreService'):GetDataStore("SaveFile2") local EventTwo = game:GetService("ReplicatedStorage").EventTwo EventTwo.OnServerEvent:Connect(function(player) local playerkey = "player-"..player.userId local SaveFiles = SaveFileTwo:GetAsync(playerkey) --the save files you want them to recover end)