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

Data Save That Saves All Hats Located In Backpack?

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago
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)
Ad
Log in to vote
0
Answered by 6 years ago

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
0
<3 SooGloezNoob 45 — 6y

Answer this question