local DStoreService = game:GetService("DataStoreService") local CashStore = DStoreService:GetDataStore("Cash")
game.Players.PlayerAdded:Connect(function(plr)
local CashValue = plr:WaitForChild("leaderstats"):WaitForChild("Cash").Value DStoreService:UpdateAsync("plr_"..plr.UserId, CashValue)
end)
game.Players.PlayerRemoving:Connect(function(plr) DStoreService:GetAsync("plr_"..plr.UserId) end)
You're supposed to call it from the CashStore
instead of the ACTUAL service itself which holds no data at all
local DStoreService = game:GetService("DataStoreService") local CashStore = DStoreService:GetDataStore("Cash") game.Players.PlayerAdded:Connect(function(plr) local CashValue = plr:WaitForChild("leaderstats"):WaitForChild("Cash").Value CashStore:UpdateAsync("plr_"..plr.UserId, CashValue) end) game.Players.PlayerRemoving:Connect(function(plr) CashStore:GetAsync("plr_"..plr.UserId) end)
Upvote if it helps! I'll appreciate it