Parenting folders not working how I want it to

  1. What do you want to achieve? I’m looking for the shopStorage and magnetInventory folder to be inside the player’s folder which should be inside of the playerstorage folder

  2. What is the issue? When I join it makes a new folder for me but after ten seconds, the folder is deleted and instead the magnetInvetory folder is in the playerStorage folder and the shopStorage is in the magnetInventory folder. Here is a screenshot: https://gyazo.com/f7f34b83875bdebaa171bc7c58ae9dfe

  3. What solutions have you tried so far? I’ve tried looking over Instances again to see if I made a mistake using them or something and I’ve also tried asking other scripters in discord servers if they know what’s wrong.

Here is the code:

local serverStorage = game:GetService("ServerStorage")
local playerStorage = serverStorage.PlayerStorage

game.Players.PlayerAdded:Connect(function(player)
    local playerFolder = Instance.new("Folder")
    playerFolder.Parent = playerStorage
    playerFolder.Name = player.Name.." Folder"
    
    -------------------------------------------
    wait(10)
    local shopStorage = Instance.new("Folder")
    shopStorage.Parent = playerFolder
    shopStorage.Name = "ShopStorage"
    
    local magnetInventory = Instance.new("Folder")
    magnetInventory = playerFolder
    magnetInventory.Name = "MagnetInventory"
end)

What I noticed is that when I spawn in it makes a folder for me, but after the ten-second wait it’s as if it deleted my folder and it is replaced with the MagnetInventory folder and the shopStorage folder goes in the MagnetInventory folder which isn’t what I want, here is a gif showing the problem: https://gyazo.com/3bef32fc994391dabd45a49a77f2d11b

Overall, this is what I get: https://gyazo.com/2cc0b480848215a3f183cbcbf8e0924d
And this is what I’m looking for: https://gyazo.com/ba55a65c12ee4bb588cdf8802799806a

Thanks for taking time to read this post! Any help would be appreciated.

did you forgot to put .Parent?

(also you don’t need to do .Parent, you can do like Instance.new(“Part”, workspace), I’m not trying to stop you from doing that)

That was the problem; I made a silly mistake and forgot to add .Parent, thanks for replying and I’ll probably keep using .Parent as that’s what I’m used to.

1 Like

that’s fine I’m not trying to stop you