I have already made a script that makes the empty data file, but the one that saves it i have never gotten to work. am i missing anything or doing anything wrong?
i want to be able to load the datastore up to an IntValue(it is saving numbers) and get it save data from IntValues
local DataStore = game:GetService("DataStoreService"):GetDataStore("CompanyData")
game.Players.PlayerRemoving:connect(function(Player)
Player:WaitForDataReady()
local Stats = Player:FindFirstChild("Data"):GetChildren()
for i = 1, #Stats do
DataStore:SetAsync(Stats[i].Name,Stats[i].Value)
end
end)
game.Players.PlayerAdded:connect(function(Player)
Player:WaitForDataReady()
local Stats2 = Player:FindFirstChild("Data"):GetChildren()
for i = 1, #Stats2 do
Stats2[i].Value = DataStore:GetAsync(Stats2[i].Name)
end
end)

1 comment
"Data" is a folder with IntValues i hope to move numbers to and from the DataStore