I dont know how to use Data Store that can save some stats, like exp mana, maxhealth, level, maxexpneeded, etc.I am new to Data Store so if someone can help me with this, I will be thankfully.The values are IntValues
Firstly, you would need to acquire DataStoreService and save the Data inside a table. Secondly, you will look through the DataStore where you are saving data if any Data is found you will use SetAsync to represent it otherwise the default.
local DataStore = game:GetService("DataStoreService") local DS1 = DataStore:GetDataStore("PlayerData") -- This is where you will save your data to.
game.Players.PlayerAdded:Connect(function(Player) local User = "user-" .. tostring(Player.UserId) -- Get the player's UserId local Data = Instance.new("Folder", Player) -- Instance a folder inside the Player local Exp = Instance.new("IntValue", Player) -- Instance an IntValue inside the Data folder.
Data.Name = "Data" Exp.Name = "Exp" local Save = DS1:GetAsync(user) if Save then Exp.Value = Save[1] else local ProgressToSave = {Exp.Value} DS1:SetAsync(user, ProgressToSave )
end)
-- Once the player is leaving the game you want to save their achievements.
game.Players.PlayerRemoving:Connect(function(Player) local User = "user-" .. tostring(Player.userId) local SaveProgress = {Player.Data.Exp.Value} DS1:SetAsync(user, SaveProgress) end)
Hopefully, I helped.
Just store them in a table and save that table to a key. You could also use multiple keys if you wished, but that is inefficient. There is limits to the length of saved data. For more information, click here