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

Why my script doesn't work saving inventory on fe in roblox ?

Asked by
gessettw -31
5 years ago
Edited 5 years ago

I have saving Inventory script on filtering enabled why it doesnt work script is placed in Workspace and Inventory in ServerStorage

game:BindToClose(function() wait(5) end)
local Data = game:GetService("DataStoreService"):GetDataStore("Inventory")
game.Players.PlayerAdded:Connect(function(plr)
 local SavedStuff = Data:GetAsync(plr.userId)
 if SavedStuff ~= nil then
  for i, v in pairs(SavedStuff) do
   if game.ServerStorage.Inventory:FindFirstChild(v)~= nil then
    local Weapon = game.ServerStorage.Inventory:FindFirstChild(v):Clone()
    Weapon.Parent = plr:WaitForChild("Backpack")
    end
   end
     end
     plr.CharacterRemoving:Connect(function()
      plr.Character.Humanoid:UnequipTools()
 end)
end)

game.Players.PlayerRemoving:Connect(function(plr)
 local Table = { }
 for i, v in pairs(plr.Backpack:GetChildren())do
  table.insert(Table,v.Name)
 end
    if Table ~= nil then
     Data:SetAsync(plr.UserId,Table)
 end
end)

Thanks for help .

0
Please use code blocks. User#19524 175 — 5y
0
i do gessettw -31 — 5y

Answer this question