Full script here even tough the only lines that arent working are lines 33 - 36, any ideas why? it isnt even printing done!
DataStore = game:GetService("DataStoreService"):GetDataStore("Stats")
SaveTime = 15 -- Saves every (SaveTime) seconds (I recommend not going under 60 seconds...)
game.Players.PlayerAdded:Connect(function(plr)
local PlayerKey = "user_".. plr.userId
local stats = Instance.new("IntValue", plr)
stats.Name = "leaderstats"
print(stats.Name)
if DataStore:GetAsync(PlayerKey)then
print("Loading " .. PlayerKey)
local Data = DataStore:GetAsync(PlayerKey)
local RDCash = Instance.new("IntValue", stats)
RDCash.Name = "RDCash"
RDCash.Value = Data.RDCash
else do -- Setups new data
local NewStats = {RDCash = 0,}
local RDCash = Instance.new("IntValue", stats)
RDCash.Name = "EXP"
RDCash.Value = 250
DataStore:SetAsync(PlayerKey,NewStats)
end
end
while true do --Save loop
wait(SaveTime)
local PlayerKey = "user_".. plr.userId
local Stats = plr.leaderstats
local Data = {}
Data.RDCash = Stats.RDCash.Value
DataStore:SetAsync(PlayerKey,Data)
print("Saved Data")
end
while true do
plr.leaderstats.RDCash.Value = plr.leaderstats.RDCash.Value + 15
print("Done!")
wait(3)
end
end)

3 comments
Awesome!!! Youre one of the best scripters ive ever met!
Did you understand why your script didn't work and what to do?
Thanks by the way, you know, there are better scripters than me to be honest