I get this error: Argument 1 missing or nil? (Line 14) Storage[i].Value = DataStore:GetAsync(Storage[i].Name)
How could i make this more efficient, please someone help me. I been working all day on this literally!
local DataStore = Game:GetService("DataStoreService"):GetDataStore("Storage") Storage = { "KOS", "WOS", "Cash", "Rank", "XP", } Game.Players.PlayerAdded:connect(function(Player) ypcall(function() repeat wait() until Player:FindFirstChild("leaderstats") end) for i=1, #Storage do if DataStore ~= nil then Storage[i].Value = DataStore:GetAsync(Storage[i].Name) end end end) Game.Players.PlayerRemoving:connect(function(Player) for i=1, #Storage do Storage[i].Value = DataStore:SetAsync(Storage[i].Name, Storage[i].Value) end end)