I’m currently trying to load the data of pets and inventory (The data is using profile service) where they are cloned into the backpack/folder .
The problem is that 20% of the time either the pets or inventory fails to load (Or sometimes both). The code to load them is below:
–Loading Invertory
local Backpack = player:WaitForChild(“Backpack”)
if profile.Data.Invertory then
for index, Item in pairs(profile.Data.Invertory) do
local Items = game:WaitForChild(“ReplicatedStorage”):WaitForChild(“Items”)
local SearchingItem = Items:FindFirstChild(Item)
if SearchingItem then
local Clone = Items:FindFirstChild(Item):Clone()
Clone.Parent = Backpack
Clone.Destroying:Wait()
print(Clone.Name…" Is destroyed")
end
end
end
–Loading Pets
if profile.Data.Pets then
for index, Item in pairs(profile.Data.Pets) do
local Items = game:WaitForChild(“ReplicatedStorage”):WaitForChild(“Pets”)
local SearchingItem = Items:FindFirstChild(Item)
if SearchingItem then
local clone = game.ReplicatedStorage.Pets:FindFirstChild(Item):Clone()
clone.Parent = player:WaitForChild(“PetFolder”)
clone
end
end
end
I’ve looked at other developer posts, searched all my other scripts to see if anything could be destroying them from there, and checked the data to ensure there is data to be loaded.