-
What do you want to achieve? Keep it simple and clear!
So question looks quite simple, but i need to get an exact id and use it after -
What is the issue? Include screenshots / videos if possible!
idk how to do that - What solutions have you tried so far? Did you look for solutions on the Developer Hub? i checked a lot of topics for that, but idk how to do that
Exactly what i’m wanna to do is:
LuckAmounts = {
"Gen1" == 0
}
or
LuckAmounts = {
[0] = "Gen1" == 0
}
I wanted to use first way,because i even idk is that possible make second way, but idk how to make it string ID
Here is code for increasing amount
local ChancesModule = require(game:GetService("ServerScriptService").MainModules.ChanceModule)
local Players = game.Players
local PlayerManager = require(game:GetService("ServerScriptService").PlayerManager)
local LuckTrigger = workspace:FindFirstChild("RemoteEvents"):FindFirstChild("LuckTrigger")
local function GetRandomGenSet(player)
for genName, odds in pairs(ChancesModule) do
if math.random() < 1/odds * 1000 then
print(genName)
PlayerManager.AddLuck(player, genName)
local LuckTable = PlayerManager.GetLuckAmounts(player)
print(LuckTable)
if table.find(LuckTable, genName) then
if odds >= 1 then
LuckTable[genName] += 1 * (odds/10)
elseif odds < 1 then
LuckTable[genName] += 1
end
LuckTrigger:FireClient(player, LuckTable)
end
end
end
end
local function InfiniteCall(player)
GetRandomGenSet(player)
task.wait(1)
InfiniteCall(player)
end
Players.PlayerAdded:Connect(function(plr)
print("Plr Added")
plr.CharacterAdded:Connect(function(Char)
wait(2)
print("Char Added")
local pHead = Char:FindFirstChild("Head")
if pHead:FindFirstChild("AdvancedGameGUI") then
InfiniteCall(plr)
print("Advanced GUI Found")
--[[else
if pHead:WaitForChild("AdvancedGameGUI") then
InfiniteCall(plr)
end]]--
end
end)
end)
Quick explain of code is: if player is lucky, his highest luck getting added to table, if it exists it just skip it and then add +1 with multipliers to that luck. But while i using [0] = “Gen1” i can’t normally add value to it by this script