Hello I have a datastore table that has two values (along with a lot of others)
I made the variables
local Milk = Instance.new("IntValue", leaderstats)
Milk.Name = "Milk"
Milk.Parent = leaderstats
local regularCow = Instance.new("IntValue", leaderstats)
regularCow.Name = "regularCow"
regularCow.Parent = leaderstats
playerData = {
["Level"] = 1,
["Exp"] = 30,
["Gold"] = 55,
["PKleaderboardexp"] = 10,
["regularCow"] = 3,
["Milk"] = 3
}
I store them in the table above, and then wrote a script to just add 10, but the datastore is no updating.
Here is the part that should add milk but doesn’t save stats or update after Heartbeat:Connect Fuction I setup to go off after 5 seconds (which is working).
local function giveMilkToPlayer(player)
local milk = player.leaderstats.Milk.Value
local cowCount = player.regularCow.Value
local milkToAdd = cowCount
milk = milk + cowCount
end
If I use the datastore GetAsync and SetAsync it will update, however I get throttling errors. What is going on as I do not understand datastores enough to access it from other scripts easily.