-
What do you want to achieve? Keep it simple and clear!
So i have an small problem. Instead of getting [""] i get something like that [""] = 1.
But in this situation i need to get all arrays names not their value. Also important so no one will say me about it. It prints 5, but when luck added it looks like that [“Luck1”] = 1 -
What is the issue? Include screenshots / videos if possible!
After deep investigation i found what it is getting amount. So my ProductionTable[luck] become nil.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I literally have an small script checker, but it didn’t help as i see
Get Money Code:
...
function ServerModule.GetMoney(player, Time)
task.wait(Time)
Income = 0
local LuckTable = PlayerManager.GetLuckAmounts(player)
local ProductionModule = require(script.Parent.MainModules.ProductionModule)
for _,lucks in pairs(LuckTable) do
print(lucks)
print(ProductionModule[lucks])
Income += ProductionModule[lucks] + PlayerManager.GetLuckAmounts(player, lucks)
end
PlayerManager.SetValue(player, "Power", PlayerManager.GetValue(player, "Power") + Income)
HeadGUI.StatsFrame.PowerLabel = "Power: "..Suffix(PlayerManager.GetValue(player, "Power"), 2).."Amp"
print(PlayerManager.GetValue(player, "Power"))
end
...
GetLuckAmounts code
function PlayerManager.GetLuckAmounts(player, luck)
if luck == nil then
return sessionData[player.UserId].LuckAmounts
elseif luck ~= nil then
return sessionData[player.UserId].LuckAmounts[luck]
end
end