I don't know why, but this doesn't seem to be working?
local DS = game:GetService("DataStoreService"):GetDataStore("Save")
game.Players.PlayerAdded:connect(function(plr)
local stats = Instance.new("IntValue", plr)
stats.Name = "leaderstats"
local cash = Instance.new("IntValue", stats)
cash.Name = "Money"
local job = Instance.new("StringValue", stats)
job.Name = "Job"
local key = "plr_"..plr.UserId
if DS:GetAsync(key) then
local stats = DS:GetAsync()
cash.Value = stats[1]
job.Value = stats[2]
else
cash.Value = 0
job.Value = "None"
end
end)
game.Players.PlayerRemoving:connect(function(plr)
local stats = plr.leaderstats
local cash = stats.Money
local job = stats.Job
local key = "plr_"..plr.UserId
DS:SetAsync(key, cash.Value, job.Value)
end)
When I rejoib, my money is "0" and my job is ""

1 comment
It says something about line 11?