Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Data Save That Saves All Hats Located In Backpack?

I have a folder located within the players backpack, designed for storing hats that you can then equip from a GUI. I don't know how to make it so when you leave, or reset, you keep the hats in the folder.... Can anyone help?

2 answers

game:GetService("Players").PlayerRemoving:Connect(function(plr)
    for _, descendant in pairs(game:GetDescendants()) do
        if descendant.ClassName == "Folder" or descendant:IsA("PVInstance") then
            game:GetService("Debris"):AddItem(descendant, 0.1) -- Adds item to store
        end
    end
end)

You should make a separate folder in the player and put the hats in there instead of putting the hats in Backpack. Everything in the Backpack gets removed when a player dies. You can also put the hats in StarterGear I think but I prefer a separate folder.

If you want to save the hats when the player leaves though, you’ll need to use something called DataStore, which is a bit more complicated than this.

######I’d also provide a script for you but you made no attempt to do this so no script 4 u. <3

1 comment

0

<3

This discussion is preserved as it was. New answers, comments, and votes are closed.