ds=game:GetService("DataStoreService"):GetDataStore("data")
game.Players.PlayerRemoving:connect(function(plyr)
data=ds:GetAsync(plyr.Name)
if data==nil then
data={["Cash"]=0,["Rubies"]=0}
else
data={["Cash"]=plyr.PlayerGui.GameGui.Cash.Value,["Rubies"]=plyr.PlayerGui.Cash.Value}
end
print(plyr.Name)
print("Cash: "..data["Cash"])
ds:SetAsync(plyr.Name,data)
print("Set Value!")
end)
It get stuck at ds:SetAsync()

4 comments
plyr.UserId instead of plyr.Name??
Nope. You can use plyr.Name for data saving.
As it had been said, using names for Data Saving is a bad practice as names can be changed.
I dont care. Still doesn't work.