-
What do you want to achieve? Keep it simple and clear!
So basically i’m currently making an game where you have 50 generators, each of them you could get randomly each 2s(could be lower with upgrades), each generator have it own chance, like this:
Generator | Chance
Gen1 | 1/1
Gen2 | 1/125
Gen3 | 1/1000
Gen4 | 1/12500
and etc.
I need to make really small chances for each gen(around more than e54), but in case of roblox limitations i can’t set those numbers normally, i already have table with all chances, here it is
local ChancesTable = {
Gen1 = 1,
Gen2 = 125,
Gen3 = 1250,
Gen4 = 12500,
Gen5 = 125000,
Gen6 = 1250000,
Gen7 = 12500000,
Gen8 = 125000000,
Gen9 = 1250000000,
Gen10 = 12500000000,
Gen11 = 250000000000,
Gen12 = 5000000000000,
Gen13 = 100000000000000,
Gen14 = 2000000000000000,
Gen15 = 40000000000000000,
Gen16 = 800000000000000000,
Gen17 = 16000000000000000000,
Gen18 = 320000000000000000000,
Gen19 = 6400000000000000000000,
Gen20 = 128000000000000000000000,
Gen21 = 12800000000000000000000000,
Gen22 = 1280000000000000000000000000,
Gen23 = 128000000000000000000000000000,
Gen24 = 1280000000000000000000000000000,
Gen25 = 128000000000000000000000000000000,
Gen26 = 12800000000000000000000000000000000,
Gen27 = 1280000000000000000000000000000000000,
Gen28 = 128000000000000000000000000000000000000,
Gen29 = 12800000000000000000000000000000000000000,
Gen30 = 1280000000000000000000000000000000000000000,
Gen31 = 128000000000000000000000000000000000000000000,
Gen32 = 12800000000000000000000000000000000000000000000,
Gen33 = 1280000000000000000000000000000000000000000000000,
Gen34 = 128000000000000000000000000000000000000000000000000,
Gen35 = 12800000000000000000000000000000000000000000000000000,
Gen36 = 1280000000000000000000000000000000000000000000000000000,
Gen37 = 128000000000000000000000000000000000000000000000000000000,
Gen38 = 12800000000000000000000000000000000000000000000000000000000,
Gen39 = 1280000000000000000000000000000000000000000000000000000000000,
Gen40 = 128000000000000000000000000000000000000000000000000000000000000,
Gen41 = 256000000000000000000000000000000000000000000000000000000000000000,
Gen42 = 512000000000000000000000000000000000000000000000000000000000000000000,
Gen43 = 1024000000000000000000000000000000000000000000000000000000000000000000000,
Gen44 = 2048000000000000000000000000000000000000000000000000000000000000000000000000,
Gen45 = 4096000000000000000000000000000000000000000000000000000000000000000000000000000,
Gen46 = 8192000000000000000000000000000000000000000000000000000000000000000000000000000000,
Gen47 = 16384000000000000000000000000000000000000000000000000000000000000000000000000000000000,
Gen48 = 32768000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
Gen49 = 65536000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
Gen50 = 131072000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
}
And second problem i need to store amount of each generator without using 50 datastore values(due optimization), how i can store them all in one value?
2. What is the issue? Include screenshots / videos if possible!
Idk how to make it
3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? I tryed to use converter script instead, but idk how to connect it with Chances
Here is my code of datastore:
local playersService = game:GetService("Players")
local dataStores = game:GetService("DataStoreService")
local dataStore = dataStores:GetDataStore("DataStore")
local protectedCall = pcall
local function onPlayerJoined(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local StatsFolder = Instance.new("Folder")
StatsFolder.Name = "Stats"
StatsFolder.Parent = player
local PlayerGUIType = Instance.new("StringValue")
PlayerGUIType.Name = "GUIType"
PlayerGUIType.Parent = StatsFolder
local PlayerGraphicsType = Instance.new("StringValue")
PlayerGraphicsType.Name = "GraphicsType"
PlayerGraphicsType.Parent = StatsFolder
local FirstVisitValue = Instance.new("BoolValue")
FirstVisitValue.Name = "GameVisited"
FirstVisitValue.Parent = StatsFolder
local PowerVal = Instance.new("NumberValue")
PowerVal.Name = "Power"
PowerVal.Parent = leaderstats
local RebirthsAmountVal = Instance.new("NumberValue")
RebirthsAmountVal.Name = "RebirthsAmount"
RebirthsAmountVal.Parent = StatsFolder
local RebirthPointsVal = Instance.new("RebirthPointsVal")
RebirthPointsVal.Name = "RP"
RebirthPointsVal.Parent = StatsFolder
local PlayerLuck = Instance.new("NumberValue")
PlayerLuck.Name = "PlrLuck"
PlayerLuck.Parent = StatsFolder
local PlayerMoney = Instance.new("NumberValue")
PlayerMoney.Name = "PlrMoney"
PlayerMoney.Parent = StatsFolder
local success, result = protectedCall(function()
return dataStore:GetAsync("Data_"..player.UserId)
end)
if success then
if result then
if type(result) == "table" then
PlayerGUIType.Value = result[1] or "Standart"
PlayerGraphicsType.Value = result[2] or "Low"
FirstVisitValue.Value = result[3] or false
end
end
else
warn(result)
end
end
local function onPlayerLeft(player)
local success, result = protectedCall(function()
return dataStore:SetAsync("Data_"..player.UserId, {player.Stats.GUIType.Value, player.Stats.GraphicsType.Value, player.Stats.GameVisited.Value})
end)
if success then
print(result)
print("Everything success")
else
warn(result)
warn("everything wrong")
end
end
local function onServerClosed()
for _, player in ipairs(playersService:GetPlayers()) do
local success, result = protectedCall(function()
return dataStore:SetAsync("Data_"..player.UserId, {player.Stats.GUIType.Value, player.Stats.GraphicsType.Value, player.Stats.GameVisited.Value})
end)
if success then
print(result)
else
warn(result)
end
end
end
playersService.PlayerAdded:Connect(onPlayerJoined)
playersService.PlayerRemoving:Connect(onPlayerLeft)
game:BindToClose(onServerClosed)
And here is code of set chances system:
local Players = game:GetService("Players")
local ChancesTable = {
Gen1 = 1,
Gen2 = 125,
Gen3 = 1250,
Gen4 = 12500,
Gen5 = 125000,
Gen6 = 1250000,
Gen7 = 12500000,
Gen8 = 125000000,
Gen9 = 1250000000,
Gen10 = 12500000000,
Gen11 = 250000000000,
Gen12 = 5000000000000,
Gen13 = 100000000000000,
Gen14 = 2000000000000000,
Gen15 = 40000000000000000,
Gen16 = 800000000000000000,
Gen17 = 16000000000000000000,
Gen18 = 320000000000000000000,
Gen19 = 6400000000000000000000,
Gen20 = 128000000000000000000000,
Gen21 = 12800000000000000000000000,
Gen22 = 1280000000000000000000000000,
Gen23 = 128000000000000000000000000000,
Gen24 = 1280000000000000000000000000000,
Gen25 = 128000000000000000000000000000000,
Gen26 = 12800000000000000000000000000000000,
Gen27 = 1280000000000000000000000000000000000,
Gen28 = 128000000000000000000000000000000000000,
Gen29 = 12800000000000000000000000000000000000000,
Gen30 = 1280000000000000000000000000000000000000000,
Gen31 = 128000000000000000000000000000000000000000000,
Gen32 = 12800000000000000000000000000000000000000000000,
Gen33 = 1280000000000000000000000000000000000000000000000,
Gen34 = 128000000000000000000000000000000000000000000000000,
Gen35 = 12800000000000000000000000000000000000000000000000000,
Gen36 = 1280000000000000000000000000000000000000000000000000000,
Gen37 = 128000000000000000000000000000000000000000000000000000000,
Gen38 = 12800000000000000000000000000000000000000000000000000000000,
Gen39 = 1280000000000000000000000000000000000000000000000000000000000,
Gen40 = 128000000000000000000000000000000000000000000000000000000000000,
Gen41 = 256000000000000000000000000000000000000000000000000000000000000000,
Gen42 = 512000000000000000000000000000000000000000000000000000000000000000000,
Gen43 = 1024000000000000000000000000000000000000000000000000000000000000000000000,
Gen44 = 2048000000000000000000000000000000000000000000000000000000000000000000000000,
Gen45 = 4096000000000000000000000000000000000000000000000000000000000000000000000000000,
Gen46 = 8192000000000000000000000000000000000000000000000000000000000000000000000000000000,
Gen47 = 16384000000000000000000000000000000000000000000000000000000000000000000000000000000000,
Gen48 = 32768000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
Gen49 = 65536000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
Gen50 = 131072000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
}
Players.PlayerAdded:Connect(function(plr)
local StatsFolder = plr:WaitForChild("Stats")
local FirstJoinValue = StatsFolder:WaitForChild("GameVisited")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SettingsGUI = ReplicatedStorage:WaitForChild("SettingsFrame")
local AdvancedGameGUI = ReplicatedStorage:WaitForChild("AdvancedGameGUI")
local GUISettings = StatsFolder:WaitForChild("GUIType")
wait(1)
if FirstJoinValue.Value == false then
SettingsGUI.Parent = plr.PlayerGui
end
if GUISettings.Value == "Advanced" then
local AGGUIClone = AdvancedGameGUI:Clone()
local pName = plr.Name
local pCharacter = workspace:FindFirstChild(pName)
local pHead = pCharacter:WaitForChild("Head")
AGGUIClone.Parent = pHead
local Frame = AGGUIClone:FindFirstChild("Frame")
for i,lines in ipairs(Frame:GetChildren()) do --- Here is exact code how i set Chances when player join(To not use datastores for them)
for i, values in ipairs(lines:GetDescendants()) do
for i, gens in pairs(ChancesTable) do
values.Value = gens
end
end
end
end
end)
After running this code i’m getting this error:
![]()


