Help with loading object script

Edit: so, i’ve tried the solutions so far and it worked but the problem now is that its cloning the pets with the PetsEquiped empty.

Code:

game.Players.PlayerAdded:connect(function(p)
	local statss = Instance.new("Folder")
	statss.Name = "PetsEquiped"
	statss.Parent = p
	
	for i,v in pairs(game.ReplicatedStorage:WaitForChild("Pets"):GetChildren()) do
		local PE = Instance.new("IntValue")
		PE.Name = tostring(v)
		PE.Parent = statss
	end
	
	local data = dataStore:GetAsync(p.UserId)
	if data then
		print(data[1])
		for _,stat in pairs(statss:GetChildren()) do
			stat.Value = data[1]
		end

		local equiped = p.PetsEquiped:GetChildren()
		if equiped ~= nil then
			p.CharacterAdded:Connect(function(char)
				for i,v in pairs(equiped) do
					local a = game.ReplicatedStorage.Pets[v.Name]:Clone()
					a.Name = v.Value
					a.Parent = char.HumanoidRootPart
				end
			end)
		else
			print("Nope")
		end
	else
		print(p.Name .. " has no pets equiped when left")
	end
end)

Example of Issue(You can’t see the actual issue clearly but you can see the particle emitter overlapping behind the pet, which isn’t originally suppose to do):

plr.PetsEquiped:GetChildren() returns an array but you’re treating it as a single value/object:

Try:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local equiped = plr.PetsEquiped:GetChildren()
		if equiped ~= nil then
			for i,v in ipairs(equiped) do
				local a = game.ReplicatedStorage.Pets[v.Name]:Clone()
				a.Name = "Pet"
				a.Parent = char
			end
		else
			print("No pets equiped when left")
		end
	end)
end)

It seems you’re trying to use an array/table as a single object. :GetChildren() returns an array of the children of the parent. Loop through the “equiped” array and complete the pet cloning in the in pairs loop.