Hello, It stops working at :GetAsync(key) command and dosen't prints the statements the output dosen't shows any error. Here my script:
local DS = game:GetService("DataStoreService") local PetDS = DS:GetDataStore("PetDataStore1") local PetDSValues = DS:GetDataStore("PetDataStore2") local PetsTable = {} local PetsValue = {} local AUTOSAVE_INTERVAL = 60 game.Players.PlayerAdded:Connect(function(Player) pcall(function() PetsTable = {} PetsValue = {} local PetsFolder = Instance.new("Folder") PetsFolder.Name = "Pets" warn("owo") PetsFolder.Parent = Player local key = Player.UserId PetsTable:GetAsync(key) print("awa") PetsValue:GetAsync(key) print(PetsTable) if PetsTable then warn("decoding") print(PetsTable) local EncodedPetsTable = game.HttpService:JSONDecode(PetsTable) local EncodedValueTable = game.HttpService:JSONDecode(PetsValue) for _,p in pairs (EncodedPetsTable) do local I = Instance.new("IntValue") I.Name = EncodedPetsTable[p] I.Value = EncodedValueTable[p] I.Parent = PetsFolder end end PetsTable = {} PetsValue = {} end) end) game.Players.PlayerRemoving:Connect(function(Player) pcall(function() local key = Player.UserId PetsTable = {} PetsValue = {} for _,p in pairs (Player.Pets:GetChildren()) do table.insert(PetsTable, p.Name) table.insert(PetsValue, p.Value) end PetsTable = game.HttpService:JSONEncode(PetsTable) PetsValue = game.HttpService:JSONEncode(PetsValue) print(PetsTable) print(PetsValue) PetDS:SetAsync(key, PetsTable) PetDSValues:SetAsync(key, PetsValue) warn("saved") end) end)
Thanks for answers!