Why clearing children of a folder is clearing NPC?

-- click button
RetrieveItem:FireServer('Shirts', v)
RetrieveItem.OnServerEvent:Connect(function(player, assetType, id)
	CustomiseStorage:ClearAllChildren() -- if I comment this one line out then the NPC stays normal
end)

Not sure what other code I should be adding here, as this is the only code that’s affecting this. But I have a dummy


But when I click a button

Bam all of a sudden all the assets on my dummy are gone. I’ve checked and this is the exact same dummy (so it’s not being replaced or anything)

The problem lies with

CustomiseStorage:ClearAllChildren()

As when I remove that one line it doesn’t destroy my dummies assets. However I need to clear the CustomiseStorage (located in repstorage) as I load assets into that folder, then from that folder, get them in the client, apply them to the dummy

1 Like

What happens when the child is deleted in replicated storage?

What do you mean? All I’m doing is clearing a folder (which there’s no checks anywhere for the folder being cleared to change the dummy)

What @xuefei123 means I assume is does your script use a system that checks for any updates to the folder’s children and then applies those children to the dummy, because if so that could be the cause of your problem since when the children are cleared there are no assets for the dummy to use.

No. There’s no checks for childadded, etc.