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!
Closed as Not Constructive by Goulstem
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?