Problem with luck system

Making just a normal luck system. and for SOME REASON it keeps changing the wrong thing here is code:

local RaritySystem = {}

function Sort(List)
	table.sort(List, function(a, b)
		return a[2] < b[2]
	end)
end

function RaritySystem.GetItem(Rarities, List)
	local NewList = table.clone(Rarities)
	if List.Luck then
		for i, v in pairs(NewList) do
			v[2] = v[2] / (1 + List.Luck/100)
		end;
		Sort(NewList)
	end
	--print(NewList)
	local RNG = Random.new();
	local Counter = 0;
	for i, v in pairs(NewList) do
		Counter += (1/NewList[i][2])
	end;
	local Chosen = RNG:NextNumber(0, Counter);
	for i, v in pairs(NewList) do
		Counter -= (1/NewList[i][2])
		if Chosen > Counter then
			return NewList[i]
		end
	end
end

return RaritySystem

this is the code calling it:

local Rarity = require(game.ReplicatedStorage.Library.Modules.Raritys)
print(Rarity)
local CubeRarity = OddsModule.GetItem(Rarity,{Luck = 1000})

it keeps printing all the numbers getting lower

also, its changing the module for every script, so it’s not a script specific thing

My new solution is just cloning the module script every time and using the cloned module.

they must be another way

What’s the “wrong thing” that it keeps changing?

I have all the rarities stored in a module and when I apply the luck it lowers all the values. so my solution was to clone the list, but it still changes the module anyways