Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.Item_Category_Example_1:FindFirstChild(v) ~= nil then
- local Weapon = game.ServerStorage.Item_Category_Example_1:FindFirstChild(v):Clone()
- Weapon.Parent = plr:WaitForChild("Backpack")
- end
- if game.ServerStorage.Item_Category_Example_2:FindFirstChild(v) ~= nil then
- local Weapon = game.ServerStorage.Item_Category_Example_2:FindFirstChild(v):Clone()
- Weapon.Parent = plr:WaitForChild("Backpack")
- end
- if game.ServerStorage.Item_Category_Example_3:FindFirstChild(v) ~= nil then
- local Weapon = game.ServerStorage.Item_Category_Example_3: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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement