local Luck = 26
local function GetLowestPossibleMoney()
local Counter = 0
for _, Money in pairs(Moneys) do
Counter += 1
local ChanceFor = Money.Chance / Luck
if ChanceFor >= 1 then
return Money.Name
elseif Counter == #Money then
return Money.Name
end
end
end
print(GetLowestPossibleMoney())
That the counter isnt adding up and making it not print anything can someone tell me what im doing wrong?
The “Counter” variable is inside the function that you later on call in your script. So every time the function activates, the variable’s value resets to 0. Put the variable outside the function and that shouldn’t be a problem.
(I have almost no scripting knowledge so all I can say is this lol.)