Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Data Save That Saves All Hats Located In Backpack?

Asked by 2 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 2 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
Denny9876 1399 Moderation Voter
2 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 28 — 2y

Answer this question