local DataStoreService = game:GetService("DataStoreService"):GetDataStore("Supplies")

local Key = "WoodKey"

  

local WoodNeeded = Instance.new("IntValue")

WoodNeeded.Name = "WoodNeeded"

WoodNeeded.Parent = game.ServerStorage

  

local Save = DataStoreService:GetAsync(Key)

  

if Save then

WoodNeeded.Value = Save[1]

else

local Numbers = {WoodNeeded.Value}

DataStoreService:SetAsync(Key,Numbers)

end

  

while wait(10) do

print("Saving Wood")

local Key = "WoodKey"

local SaveGroup = {WoodNeeded.Value}

DataStoreService:SetAsync(SaveGroup, Key)

end

This is my code, i've set it to save the value every 10 seconds for testing purposes, but it still doesn't work.

I must be doing something wrong, but i still can't figure it out.

2 comments

0

Just hardcode the datastore key as some constant string????????????

0

I have shown the script, so any help would be appreciated.