Loop acting weird

I have marked some points in the script, but the problem is that 5xDucks does show up in a loop before the big function, but in the loop in the big function. It doesn’t show up, it’s really weird.

local dataStore = game:GetService("DataStoreService")
local serverData = dataStore:GetDataStore("ServerData19")
local replicatedStorage = game:GetService("ReplicatedStorage")

local upgradeModule = require(game.ServerScriptService.UpgradesModule)

local upgradesFolder = workspace.UpgradesFolder
local upgradesHiddenFolder = game.ReplicatedStorage.UpgradesHidden
local goldenUpgradesFolder = workspace.GoldenUpgradesFolder
local statsFolder = replicatedStorage.Stats
local ducks = replicatedStorage.Stats.Ducks
local dataLoaded = game.ServerScriptService.DataLoaded

--if game.PrivateServerId == "" then -- if the game is not a private server, PrivateServerId will be ""
--return -- end the saving stuff here
--else
-- put everyteverythinghing in here
--end

local getData = serverData:GetAsync(game.PrivateServerOwnerId) -- maybe change to PrivateServerId instead of PrivateServerOwnerId
print(getData) -- does print 5xDucks
local function getUpgradeData(currentUpgradeFolder)
	for i,v in currentUpgradeFolder:GetChildren() do
		local folderModule = string.gsub(currentUpgradeFolder.Name,"UpgradesFolder","").."Upgrades"
		if upgradeModule[folderModule][v.Name].Hidden then
			if upgradeModule[folderModule][v.Name].Hidden == true then
				v.Parent = upgradesHiddenFolder
			end
		end
	end
end

if not getData then
	getUpgradeData(upgradesFolder)
	getUpgradeData(goldenUpgradesFolder)
end

for i,v in upgradeModule.Upgrades do
	print(v.Name) -- does print 5xDucks
end

local function spawnUpgrades(newUpgradesFolder,color)
	for i,v in upgradeModule[string.gsub(newUpgradesFolder.Name,"UpgradesFolder","").."Upgrades"] do -- Doesnt print 5xDucks, while it's looping through the same thing and other things do print
		if not getData[v.Name] and not getData[v.Before] and v.Hidden == true then
			newUpgradesFolder:FindFirstChild(v.Name).Parent = upgradesHiddenFolder
		elseif getData[v.Name] then
			local currentUpgrade = newUpgradesFolder:FindFirstChild(v.Name)
			currentUpgrade.Owned.Value = true
			currentUpgrade.SurfaceGui.Price.Text = "Owned"
			currentUpgrade.SurfaceGui.Info.Text = v.Info
			currentUpgrade.Color = color

			if upgradeModule.UpgradesFunctions[currentUpgrade.Name] then
				upgradeModule.UpgradesFunctions[currentUpgrade.Name]()
			end
		end
	end
end

if getData then
	for i,v in statsFolder:GetChildren() do
		if getData[v.Name] then
			v.Value = getData[v.Name]
		end
	end

	spawnUpgrades(upgradesFolder,Color3.fromRGB(110, 110, 112))

	spawnUpgrades(goldenUpgradesFolder,Color3.fromRGB(113, 90, 0))
end

This is the module:

local upgradesModule = {}

local statsValues = game.ReplicatedStorage.Stats
local ducks = game.ReplicatedStorage.Stats.Ducks
local upgradesFolder = workspace.UpgradesFolder

upgradesModule.Upgrades = {
	["DoubleDucks"] = {Name = "DoubleDucks",Hidden = false,Info = "2x Ducks",Price = 35,Multiplier = 2},
	["TripleDucks"] = {Before = "DoubleDucks",Hidden = true,Name = "TripleDucks",Info = "3x Ducks",Price = 115,Multiplier = 3},
	["1.5xDucks"] = {Before = "TripleDucks",Hidden = true,Name = "1.5xDucks",Info = "1.5x Ducks",Price = 335,Multiplier = 1.5},
	["1.75xDucks"] = {Before = "TripleDucks",Hidden = true,Name = "1.75xDucks",Info = "1.75x Ducks",Price = 565,Multiplier = 1.75},
	["SlowAutoClicker"] = {Before = "1.75xDucks",Hidden = true,Name = "SlowAutoClicker",Info = "Slow auto clicker every second",Price = 1400},
	["3.5xDucks"] = {Before = "1.5xDucks",Hidden = true,Name = "3.5xDucks",Info = "3.5x Ducks",Price = 1400,Multiplier = 3.5},
	["5xDucks"] = {Before = "1.75xDucks",Hidden = true,Name = "5xDucks",Info = "5x Ducks",Price = 6400,Multiplier = 5},
	["MoreDucksWithDucks"] = {Before = "TripleDucks",Hidden = true,Name = "MoreDucksWithDucks",Info = "The more ducks you have the more duck you get: 1x",Price = 36000},
	["UnlockGoldenDucks"] = {Before = "MoreDucksWithDucks",Hidden = true,Name = "UnlockGoldenDucks",Info = "Unlock Golden Ducks and upgrades",Price = 250000},
}

upgradesModule.GoldenUpgrades = {
	["DoubleGoldenDucks"] = {Name = "DoubleGoldenDucks",Order = 1,Hidden = true,Info = "2x Golden Ducks",Price = 5,GoldenMultiplier = 2},
	["TripleGoldenDucks"] = {Before = "DoubleGoldenDucks",Hidden = true,Name = "TripleGoldenDucks",Info = "3x Golden Ducks",Price = 12,GoldenMultiplier = 3},
}

return upgradesModule