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

calling call items inside of a players inventory in one data store?

Asked by
Plieax 66
5 years ago
local DSS = game:GetService("DataStoreService")
local saveitems = DSS:GetDataStore("ItemSaveSystem")



game.Players.PlayerAdded:connect(function(plr) -- whenever a player joins this will tell the game still save the inventory for players who joined after the first player updating the player list -- 
    wait(6)
    local players = game.Players:GetChildren()
    for i,v in pairs(players) do
        local items = v.gamepack:GetChildren() -- Inside of the gamepack is a bunch of Int Values, the things i want to save -- 
        for i,v in pairs(items) do
            v.Changed:connect(function() -- Whenever an int value is changed it needs to save to the datastore --
                saveitems:SetAsync(plr.UserId,v)
            end)
        end
    end
end)

I need to know how to make this data load into the players backpack, please help.

0
You are putting events inside of loops, which is not okay. User#19524 175 — 5y

Answer this question