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

How can you create a script that saves your inventory with data storage?

Asked by 6 years ago

I know how to make it the old way but I wanted to use the same inventory across different servers from the same place so I would apreciate if anyone could help me out on turning this on to the most recent version.

    game.Players.PlayerAdded:connect(function(player)

        local inventory=player:LoadInstance("Inventory")or Instance.new("Model")

        inventory.Name="Inventory"

        inventory.Parent=player

    end)

    game.Players.PlayerRemoving:connect(function(player)

        player:SaveInstance("Inventory",player.Inventory)

    end)

I know how to work with data stores when its me creating the tables, not when im using something already created by roblox.

0
You used an or, so I don't know if you know if the script should load or create a new Instance saSlol2436 716 — 6y
0
So, I think you should have local invSaved = player:LoadInstance("Inventory") then, local model = Instance.new("Model") saSlol2436 716 — 6y
0
This seems to be deprecated. Azarth 3141 — 6y
0
Simply put the gears into StarterGear (it's in the player) and the inventory (if you want the player to own the gear immediately) LeadRDRK 437 — 6y

Answer this question