Hey Bl_ueHistory
Hope this helps I commented on the code a little so you can see it :)
Please remember to upvote if it works! :D
01 | local Datastore = game:GetService( "DataStoreService" ):GetDataStore( "PlayerDataV1" ); |
04 | game.Players.PlayerAdded:Connect( function (player) |
05 | local inv = Instance.new( "Folder" ,player) |
06 | inv.Name = "Inventory" |
07 | if Datastore:GetAsync(player.UserId) then |
08 | for i,v in pairs (Datastore:GetAsync(player.UserId)) do |
09 | print ( "Name: " .. v [ 1 ] .. " || Price: " .. v [ 2 ] ) |
12 | local int = Instance.new( "IntValue" , inv) |
13 | int.Name = "LinkedSword" |
16 | local Pistol = Instance.new( "IntValue" ,inv) |
17 | Pistol.Name = "Pistol" |
23 | game.Players.PlayerRemoving:Connect( function (player) |
24 | for i,v in pairs (player.Inventory:GetChildren()) do |
25 | table.insert(itemlist, { v.Name, v.Value } ) |
27 | Datastore:SetAsync(player.UserId, itemlist) |