So i'm making a Christmas game, so it will be out by Christmas. This won't save for some reason, I am changing the values, and everything. Please help.
startCookies = 0
startMilk = 0
DataStore = game:GetService("DataStoreService")
DsC = DataStore:GetDataStore("CookiesDataStore")
DsM = DataStore:GetDataStore("MilkDataStore")
game.Players.PlayerAdded:Connect(function(plr)
local Folder = Instance.new("Folder")
local CookiesValue = Instance.new("NumberValue")
local MilkValue = Instance.new("NumberValue")
MilkValue.Name = "Milk"
CookiesValue.Name = "Cookies"
Folder.Name = "Currency"
Folder.Parent = plr
CookiesValue.Parent = Folder
MilkValue.Parent = Folder
CookiesValue.Value = DsC:GetAsync(plr.UserId) or startCookies
MilkValue.Value = DsM:GetAsync(plr.UserId) or startMilk
CookiesValue.Changed:connect(function()
DsC:SetAsync(plr.UserId, CookiesValue.Value)
print(plr.UserId.."'s Value of"..CookiesValue.Value)
end)
MilkValue.Changed:connect(function()
print(plr.UserId.."'s Value of"..MilkValue.Value)
DsM:SetAsync(plr.Userid, MilkValue.Value)
end)
end)

1 comment
here use this instead https://devforum.roblox.com/t/how-to-use-datastore2-data-store-caching-and-data-loss-prevention/136317