i have save data for my leaderstats already, i was wondering how to implement it into my code. heres my savedata code.
local DS = game:GetService("DataStoreService"):GetDataStore("SaveMyData") game.Players.PlayerAdded:Connect(function(player) wait() local playerkey = "id_"..player.userId local savevalue = player.leaderstats.Points local savevalue2 = player.leaderstats.Prestige local GetSaved = DS:GetAsync(playerkey) if GetSaved then savevalue.Value = GetSaved[1] savevalue2.Value = GetSaved[2] else local NumbersForSaving = {savevalue.Value, savevalue2.Value} DS:GetAsync(playerkey, NumbersForSaving) end end) game.Players.PlayerRemoving:Connect(function(player) DS:SetAsync("id_"..player.userId, {player.leaderstats.Points.Value, player.leaderstats.Prestige.Value}) end)
leaderstats
game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Model") leaderstats.Name = "leaderstats" leaderstats.Parent = player local money = Instance.new("IntValue") money.Name = "Points" money.Value = 0 money.Parent = leaderstats local money = Instance.new("IntValue") money.Name = ("Prestige") money.Value = 0 money.Parent = leaderstats local money = Instance.new("BoolValue") money.Name = "DoublePass" money.Value = false money.Parent = player end)