local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("MeditationSaveSystem")
local ds2 = DataStore:GetDataStore("StrengthSaveSystem")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Model")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Meditation = Instance.new("IntValue")
Meditation.Name = "Meditation"
Meditation.Value = ds:GetAsync(player.UserId) or 0
Meditation.Parent = leaderstats
local Strength = Instance.new("IntValue")
Strength.Name = "Strength"
Strength.Value = ds2:GetAsync(player.UserId) or 0
Strength.Parent = leaderstats
game.Players.PlayerRemoving:Connect(function(player)
ds:SetAsync(player.UserId, player.leaderstats.Meditation.Value)
ds2:SetAsync(player.UserId,player.leaderstats.Strength.Value)
end)
end)
This code is meant to save the values when the player leaves but it does not save them may someone help me fix this thanks.

1 comment
THANKS ALOT!