ds=game:GetService("DataStoreService"):GetDataStore("data")
game.Players.PlayerRemoving:connect(function(plyr)
data={["Cash"]=plyr.PlayerGui.GameGui.Cash.Value,["Rubies"]=plyr.PlayerGui.GameGui.Rubies.Value}
print(plyr.Name)
print("Cash: "..data["Cash"])
ds:SetAsync(plyr.Name,data)
print("Set Value!")
end)
I debugged it using print and found it gets stuck at ds:SetAsync()
(Note to mods, or people who can moderate. Yes, this is a duplicate of This question
But, To quote the note i got for posting a duplicate before, "This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here."
The past answers do not fully address my question. Thank you for understanding why this should NOT be marked as duplicate

5 comments
I'm having the same issue, figured I was just doing something wrong somewhere.
What part of this doesn't work?
@Times i said, i get stuck on ds:SetAsync(), that wont run, nothing past it runs
Quoting from the wiki: "Using GetAsync to retrieve a value and then setting the key with SetAsync is dangerous because GetAsync sometimes returns cached data."
As far as I can see, you don't need to access the existing data and check whether or not it's nil . As long as you aren't doing anything with the existing data, it doesn't matter whether it's nil or not.