Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

data dosen't save even when I did a loop and used findfirstchild?

Asked by 5 years ago
Edited 5 years ago

So basically the inventory is a folder with weopons inside it and the weopons all have a IntValue inside them called IDNumber each of them have a value the variable nok is the IntValue it won't save for some reason



local DataStore = game:GetService("DataStoreService"):GetDataStore('ToolSave') game.Players.PlayerAdded:Connect(function(plr) local savedStuff = DataStore:GetAsync(plr.userId) if savedStuff ~= nil then for i,v in pairs(savedStuff) do for a,k in pairs(game.ServerStorage.Inventory) do IDnumebr = k:FindFirstChild('IDNumber') if v == IDnumebr.Value then print(k.Name) local weopon = IDnumebr.Parent:Clone() weopon.Parent = plr:WaitForChild('Backpack') end end end end plr.CharacterRemoving:Connect(function() plr.Character.Humanoid:UnequipTools() end) end) game.Players.PlayerRemoving:Connect(function(plr) Table = {} for i,v in pairs(plr.Backpack:GetChildren()) do table.insert(Table,v:WaitForChild('IDNumber').Value) end if Table ~= nil then DataStore:SetAsync(plr.userId,Table) end end)

Answer this question