-
What do you want to achieve? Keep it simple and clear!
So basically i need to put in value like instead of “100000” to 100k, because in case of roblox limitations i can’t make huge value of chance
-
What is the issue? Include screenshots / videos if possible! Idk how to convert it like that
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I tryed to set values by myself, but this is hard and roblox have limits
I wanna make it with script or maybe without it, any ideas how to do that?
I wanna make something like in luck simulator better here is an screenshot:
I set up values by myself max to qn and after that there is discord limitations, idk how to make it more
This is my number abbreviation script, you can keep adding more powers of 10 if you want.
function aberviate(number)
local abreviations = {
[3] = "K",
[6] = "M",
[9] = "B",
[12] = "T",
[15] = "Qa",
[18] = "Qi",
[21] = "Sx",
[24] = "Se",
[27] = "Oc",
[30] = "Nn"
}
if number < 1000 then
return number
elseif string.find(tostring(number),"e+") then
local split = string.split(tostring(number),"e+")
if split[1] and split[2] then
local power = tonumber(split[2])
if power then
local abreviation = power - (power % 3)
local truepre = tonumber(split[1])
if truepre then
local preAb = tostring(truepre * (10^(power-(abreviation)))) .. " "
return preAb .. abreviations[abreviation]
end
else
return number
end
end
elseif not string.find(tostring(number),"e+") then
local num = tostring(math.floor(number))
local length = #num
local trueLength = #num % 3
if trueLength == 0 then
trueLength = 3
end
local abreviation = abreviations[length-trueLength]
if abreviation then
local startNum = string.sub(num, 1, trueLength) .. "."
local decimals = string.sub(num, trueLength+1,trueLength+2) .. " "
if startNum and decimals then
return startNum .. decimals .. abreviation
else
return number
end
else
return number
end
end
end
Thanks, but, how do i make this to the value?
What do you mean? Well this is how you use it
local number = aberviate(1230000)
print(number) --> 1.230 M
Oh, i mean i need to put this number in the value, I have chance value for each generator. Like gen1 1/1 gen2 1/125 gen3/1.25k and etc.
This is one of 50 values (30 lettersssssssss) + one of 50 chance values
Well you can make a math function to get the denominator of your chance fraction then put it into the abreviator then take the result and concatenate it like:
local fraction = "1/"..tostring(number)
Hmm, it’s good idea, but i need to random each second to get new gens, like random.math, but i can’t use random.math with .x numbers?
Im confused what you mean. You want to generate random numbers with the fraction but can use the string? Yeah just hold the original value then do math.random(1,chanceInteger)
I mean, each second there will be running random math in other script which randomly could give you any of generators, but as i remember i can’t use fractional numbers?
And also how i could using this script put all chances in 50 values, using for loop maybe
Im talking about just for display. You can display the fraction like you wanted in the GUI and the rest can be normal.
I mean i can’t use fractional numbers in math.random? or i can?
Yes but I don’t see how this helps.
Ok thanks it help me, another quick question i need to put those chances(number) in all 50 values, i wanted to use smth like that
local Frame = AGGUIClone:WaitForChild("Frame")
for i, lines in ipairs(Frame:GetChildren()) do
for i, buttons in ipairs(lines:GetChildren()) do
buttons:FindFirstChild("Chance").Value = 0-- Here i need to edit values for chances
end
But i i need 50 values not one, and all values(chances) are different
You have the chances right? You can make a table of these chances then iterate through them to run the random number. I’m just not quite sure what your trying to accomplish.
So i could just make smth like that
local ChanceTables = {
Gen1Chance = 1
Gen2Chance = 25
Gen3Chance = 250
Gen4Chance = 1250 -- and etc
}