local dataStoreService = game:GetService("DataStoreService")
local dataStore1 = dataStoreService:GetDataStore("PlayerCurrency")
strength = dataStoreService:GetDataStore("Strength")
meditation = dataStoreService:GetDataStore("Meditation")
function create(name,classname,parent)
local it = Instance.new(classname)
it.Parent = parent
it.Name = name
return it
end
game.Players.PlayerAdded:Connect(function(plr)
local ls = create("leaderstats","Folder",plr)
local med = create("Meditation","IntValue",ls)
local str = create("Strength","IntValue",ls)
str.Value = strength:GetAsync(plr.UserId) or 0
med.Value = meditation:GetAsync(plr.UserId) or 0
game.Players.PlayerRemoving:connect(function(plr)
dataStore1:SetAsync(plr, meditation.Value)
dataStore1:SetAsync(plr, strength.Value)
end)
end)
Im trying to make it save the values on the leader stats when the player leaves may someone help please thanks!

2 comments
http://wiki.roblox.com/index.php?title=Saving_Player_Data
+1 to omit moderation rep loss