Adding new course units soon, buy now to get them for FREE: linktr.ee/ByteBlox
@awesomesauce-kg9xn7 ай бұрын
Change your name to freakyblox now
@hqTheToaster7 ай бұрын
Actually, I agree with you. I didn't make rarity before. The closest to rarity that I made is a 'fair' randomizer. (one in a row or two in a row randomizer for maps.)
@grindhub83407 ай бұрын
FreakyBlox
@summonandthe81277 ай бұрын
e
@cozz1247 ай бұрын
day 6 of asking byteblox to release an onlyfans
@eclair16167 ай бұрын
No. You just don’t implement rarity. You only want to make it as if there is rarity but in reality you will only get common items, and then you make a button to get legendary with robux.
@MaddestCattestGaming7 ай бұрын
Against Roblox ToS + generally scummy behavior, it's just a better option overall to make it honest based on my experience. Instead, just inflate the perceived value of whatever you earn whenever robux is used.
@eclair16167 ай бұрын
@@MaddestCattestGaming it was a joke - but just so you know most games do that, and Roblox doesn’t care because they also get money off his, because they get 70% of the robux.
@Avysilvasan7 ай бұрын
gimme oux
@i0x377 ай бұрын
@@eclair1616they get 30% not 70%
@azurelava77967 ай бұрын
@@i0x37Well Roblox takes 30% of the robux, and when you exchange robux for USD through the DevEx system, it’s at a rate way lower than when you buy robux. So overall they take about 75%.
@ZaeNonQ7 ай бұрын
me when i use "pick random from 1 to 100" in scratch:
@eclair16167 ай бұрын
Scratch isn’t a PRACTICAL programming language. (It is but it’s useless in actual scenarios, apart from learning. Did you even hear a company say “I’m gonna make my next multi billion AAA application in scratch”? No, because it’s useless for everything else apart teaching young people about who programming works. You cannot even make a windowed application with it. (I mean a native application, using the windows API, not some junky scratch way to fake a window)
@officialcbyt7 ай бұрын
@@eclair1616 Scratch is as much a programming language as Roblox Lua. They're both methods of executing code inside of another program. Just because Scratch is a visual language doesn't mean it isn't a programming language
@opa80127 ай бұрын
@@eclair1616 also he never even said anything about a programming language
@keppelin15277 ай бұрын
J
@neonstix10357 ай бұрын
@@eclair1616it is, it’s block coding. Even unreal engine has block coding.
@HarrisssT4 ай бұрын
Ngl I worked this out on my own when I was learning to code, the title is a massive overstatement.
@f5tornado831Ай бұрын
I haven't even watched the video, and I think I know how to do it.
@Panjy_5 ай бұрын
The downside of this method is that the legendary isn’t a 1% chance but in fact a 0.25% chance because of the random selection of the loop then the random number selection.
@kurmeklis84123 ай бұрын
nuh uh
@Panjy_3 ай бұрын
@@kurmeklis8412 yuh huh
@yhnah13293 ай бұрын
@@kurmeklis8412 Math
@descai102 ай бұрын
wrong
@Panjy_2 ай бұрын
@@descai10 nuh uh
@buuild5 ай бұрын
For those who understand the code but don't understand how the system works, and why, here's an explanation: Let's say your rarity weights are: {"common" = 60, "rare" = 20, "legendary" = 1}. The total weight is 81 (60 + 20 + 1). Imagine a number line from 1 to 81. The "common" rarity "owns" the range from 1 to 60 (its weight). The "rare" rarity "owns" the range from 61 to 80 (weight of common + weight of rare). The "legendary" rarity "owns" the last spot (81). If the random number is 35, it falls within the range owned by "common" (1 to 60) and thus "common" is chosen. By accumulating weight, we create a system where the random number effectively "lands" on a specific portion of the line based on the weight distribution, ensuring each rarity has the intended chance of being chosen.
@McDoubleMortem5 ай бұрын
This is exactly what I was trying to understand. Thanks random internet person who commented on a random youtube video about roblox
@buuild5 ай бұрын
@@McDoubleMortem no problem
@zacvh_4 ай бұрын
I understand the code but I don’t understand what makes this harder than you’d think
@pinyw6833 ай бұрын
You explained it so well
@exwend759714 күн бұрын
but if randomnumb is 61 , randomnumb > 60
@SuppressedMountain7 ай бұрын
Bro you arrived in a great time, I just got to roblox lua scripting and these videos are teaching me better than my courses lol
@_blaze_90455 ай бұрын
Hey do you have discord? I’d like to talk abt something
@SuppressedMountain5 ай бұрын
@@_blaze_9045 ?
@j.54024 ай бұрын
What courses are you taking I am looking for some
@vclie3 ай бұрын
hey i also want to knwo what coursesare yuo learning
@chaosincursion7 ай бұрын
funnily enough, i made a rarity system using this concept in obby creator like 3 years ago without even realizing this is how rarity systems work in roblox coding
@anasdari60744 ай бұрын
its easy legendary = math.random1,100
@RelixEnd3 ай бұрын
@@anasdari6074 no lol. you would need to make it so if the number is = 100 then legendrary else other ones
@hqTheToaster7 ай бұрын
Actually, tbh, I agree with you. Rarity is harder than I think. Haven't had to program rarity before. The closest I got was programing a sort of 'fairness' system in randomizing maps. (1 in a row, and 2 in a row.)
@NaraSherko7 ай бұрын
I did for a iq rng game
@summonandthe81277 ай бұрын
ýes
@CrazyDoodEpicLeaves7 ай бұрын
@@NaraSherko The concept of a "IQ RNG" game is so ironic, because only dumbasses would play it
@SunnyNightsStudios7 ай бұрын
Making a map only pop up once is easy and rarity is not even that hard, I was able to script a pet rarity system and guess what im technically not wven an expert yet Im intermediate smth
@hqTheToaster7 ай бұрын
@@SunnyNightsStudios I have no rebuke of notable difference. It took me a while just to 'repair' the Randomizer that LittleBigPlanet 2 eventually gave me. (I wanted a shuffler and got a 'turn on until full and reset' as the prefabricated option to work with.) My skill is... prefabrication-beginner, maximum. Though, I still know my way around the Roblox Wiki, and am willing to type out the long way around to making something work, even if it is a bunch of if-thens instead of clever 'typewriter exclusion'. But again, if it is a contest context, you have me beat.
@alpha41947 ай бұрын
rarity while seeming initially hard isnt that bad when you get around to understanding tables, so i decided id program a simple lua weighted randomizer and send it here for people to reference if they manage to see this comment first we wanna start off with a table, which is essentially a list. However, each list is only really allowed to have one entry within each line, so to make things more optimized we are effectively putting a small list containing the NAME of the item, as well as its rarity. the rarity in question acts more as a 'frequency' meaning the higher the number, the more abundant the object would become. the template is essentially {(brick color),(frequency)} afterwards we are going to run code that makes a new table (list), that inserts each entry of the original table (list) the number of times of its frequency. Meaning the white brick in the situation (view below) would be written down on the list 100 times. We do this for every entry and effectively have a long imaginary list with 230 entries (in the situation im showing off below.) The final part of this is picking a random number from 1 to the number of entries we have, and just taking the object from the spot in the list! ------------------------- local OurExampleList = { {"White Brick",100}; -- common {"Purple Brick",70}; -- Uncommon {"Green Brick",50}; -- rare {"Orange Brick",10}; -- legendary i guess } local ImaginaryList = {} --imaginary list that is used for later to decide which specific brick we want by inserting the (total of) 230 possibilities into for CurrentIndex, CurrentListEntry in OurExampleList do for count =1,CurrentListEntry[2] do --see the [2]? This is important here because we are sorting through the original example list, which has mini lists and we want the rarities from the mini lists. CurrentListEntry is also technically one of these, which can be found from the CurrentIndex (meaning the mini list {"White Brick",100} is found when CurrentIndex is at 1) table.insert(ImaginaryList,CurrentListEntry[1]) -- places the current entry into the imaginary list, this is run as many times as its frequency end end local Result = ImaginaryList[math.random(1,#ImaginaryList)] --This is another index similar to [2], but we are picking a random entry, from 1 (the first entry) to the TOTAL number of entries (which is essentially 230) print(Result) ------------------------- sorry for lack of formatting or if I was to vague on any topics, but this is just some simple sample code that is a nice stepping stone to understanding absolute essentials to development
@alpha41947 ай бұрын
this system integrates rarities AND parts to be part of a simple 18 line piece of code. if you really wanted to instead of printing the result you could use the string (the parts that say "White Brick", "Purple Brick", and so on and so forth) to identify parts you already stored. if we wanna do essentially what is being done here, we could (in place of print(Result)) replace with ----------- local PartClone = game.ServerStorage.Things:FindFirstChild(Result):Clone() Partclone.Parent = workspace.SpawnedParts ----------- This essentially finds the part by the name of our table entries meaning if your common/grey brick is named "White Brick" the code would be able to identify it within the storage folder, clone it, and throw it in workspace's folder very simply
@Godsent_Prophet7 ай бұрын
You eradicating the redundant roblox tutorials with the one
@Noob-ot8rf7 ай бұрын
fr i put both together in a table inside the main table instead of making the index a string
@PeterMyler7 ай бұрын
Ok but the problem with is that if i change the frequency of one item, it affects the chances of the rest, since the total frequency number has changed. Idk how to fix this though, that's why rarity systems actually seem kinda hard to me
@alpha41947 ай бұрын
@@PeterMyler in an instance where this is an issue, you can instead of just contacting a single value, have the value represent something more. Lets say whitebrick had multiple variants but didnt wanna lower the odds of the other bricks by cluttering the pool, make whitebrick a folder in serverstorage, and run code that will pick a random object FROM that folder. Basically, check list, find desired category (common, uncommon, etc) and pick a random instance from your category. When picking the random instance, every instance should be equally weighted. If you want a code example lmk ill code one
@Lukas_Vx7 ай бұрын
1:26 yes, replicatedstorage
@FriedRatEater5 ай бұрын
you mean thats not a good place to put it or smth?
@Ninja402945 ай бұрын
@@FriedRatEater He said ReplicatedStorage instead of ServerStorage (which is where he was putting the stuff)
@ilovemystove4 ай бұрын
@@FriedRatEaterserver storage is good because exploiters cant access it when theyre looking through the files
@FriedRatEater4 ай бұрын
@@ilovemystove ah k, thats very helpful. Thanks
@Umbra_Vitae3 ай бұрын
@@FriedRatEaterjust keep in mind that only the server has access to ServerStorage, so if you’re using clientside coding you’d have to get the stuff from the server first, replicatedstorage can be accessed from both server and client
@thedoggod77375 ай бұрын
i've made a rarity system before and it worked pretty well, i'll try explain it a bit simply here. pretty much have a list of things with a rarity e.g. if its 1 in 1000 make its chance 1000 times all the chances together and this is your weight or totalVal now theres 2 methods i use to expand from this: 1. less complicated but you simply get a random number, sort the list of rarities from rarest to most common, and check if the random number is less than or equal to the (totalVal / chance) 2. allows for multiple rarities of the same chance, because with 1. you can only have something like 1 in 1000 once for example, first you have to create a lowerBound variable and another variable "currentLowest" for example which starts at 0 , for each rarity you set its lowerBound var to currentLowest + 1, and then you create another variable "higherBound" for the rarity, which is set to (currentLowest + totalVal / chance), at last you create the random num and check for each rarity if the number is between the lowerbound or higherbound rarity sorry if this seems all complicated but i kind of just wrote this from the top of my head, hope this helps anyone oh P.S, you'll need to use Random:NextInteger rather than math.random because math.random can't handle large numbers, which can become a problem when multiplying multiple rarites for the total val
@Pygim7 ай бұрын
I tried to make a rarity in a different project in a different language, and I gave up, decided to use a simple formula to decide the chance of each rarity. It's not perfect but it gets the job done.
@DpJordi7 ай бұрын
I had a system for my now abandoned game. The rarity system was so advanced. It had to take like 8 values in mind when generating. It was basically an armour generator. Where each piece had multiple stats. But certain stats where handled differently. Before i started it, i thought it was gonna be super easy. shit was harder than anything ive done. It also had to work with data saving. I had like 5d array for each stat. Crazy. It used like 5 scripts in total. the rarity script was like 300+ lines. And when i code, i code to make it as efficient as possible. Then i realised, its roblox. It doesnt need to be this complicated. So now i stick to simpler games.
@Gogo-jl4sh5 ай бұрын
Honestly what u were doing with the advanced rarity system was really cool, Roblox can be simple but complicated if you really want to make advanced and unique systems. I'd say to continue to go through the hard path (it also is just good practice for when you want to develop games in different languages) games like Deepwoken use very complicated algorithms so that players can have more freedom with their builds, so it's not as if your efforts will be going to waste as quite a few people do appreciate developers programming in unique mechanics like the one u did.
@Tealen4 ай бұрын
5 scripts is too much no?
@DpJordi4 ай бұрын
@@Tealen if u need 5 scripts, u need 5 scripts. If u need 10 u need 10. Of course always try to do it in as less as possible. But there is no “too much”. As long as it’s efficient, it’s good.
@Tealen4 ай бұрын
@@DpJordi cant you just do it all in on script i know that performance wise theres not much of a difference but maybe it would be a bit more organized? Why would you need to make 5 scripts for one single mechanic, that can be achieved with presumably 1 script. Im saying this without looking at the mechanics so maybe it ends up being more organized if each section is separated by different modules, but if im guessing correctly you should only need one for that.
@DpJordi4 ай бұрын
@@Tealen you’re guessing wrong. You already need 2 scripts for client and server. And u need another script for the datastore. Is already 3 scripts. Then u need a module script to calculate all the values. U could do this all 1 server script. But then u have ur datastore, ur calculation stuff and like the server script that talks with the client all in 1. Which isnt nearly as organized and easy to read as just using multiple scripts with their own clear names. I had my 1. Client script 2. Datastore 3. Module script to calculate all the values 4. Script to use them values. It’s much easier to manage 4 “smaller” scripts than to manage 1 big script with all the stuff in it. It’s also a matter of runtime. Code runs line by line. 1 big script would run all that line by line. Wich isn’t always what u want. U could use couratines/spawn. But it’s much better to just use another script, than a bunch of spawn functions. Which would hurt performance more.
@Hermit_Wish7 ай бұрын
Thank you for this. And to all the viewers here, there's multiple variants of weighted RNG, I would highly recommend to try things out such as making an alternative to math.random(), or find another way to calculate the result. It's a complex system and there's no system that suits all, experiment with it. And with such, another method to this video is to add up all the weight values and multiplying it math.random() with nothing in the parentheses; from there, you go through each weight again and remove it from the accumulated weight that you got from multiplying till you reach 0 or less and return the item that triggered that check. However, by doing this method, you may see that high rarities will appear to be more common depending on the weight you assigned. Again, I highly recommend you to try things out and find new ways; step a little out of your comfort zone, but not by too much, learn from the behaviors and mistakes you come across.
@azurelava77967 ай бұрын
If you’re using RNG, you use math.random(), because why would you want to create your own pseudo-random function? Unless it’s not random and you’re following a cycle of results. And you said that you could use math.random() * WEIGHT_TOTAL, but that’s literally the exact same thing. math.random(start, end) is equal to math.floor(math.random() * (start - end + 1)) + start.
@Hermit_Wish7 ай бұрын
@@azurelava7796 1. Yes, but only if you want it to repeat, it's the old way of doing RNG and still holds true to this day, that being said, you can easily update the seed with something unpredictable each time you are required to do so or whenever a button is pressed. 2. Right for the wrong reasons. try it first, you'll get different results as weird as that may sound.
@Hermit_Wish7 ай бұрын
something or someone removed my comment... 1. pseudo-random can be repeating if you want it to, there's ways to make it non-repeating. 2. while yes, math.random() * weight_total is the same as math.random(1, 100), it will yield slightly different results and I'll be honest, I don't know why, my best guess is the float point error, you'll also get slightly different results depending if you use a weight counter or remove weight from math.random(1, 100).
@apekz35927 ай бұрын
local x = random(1,round(1/(rarity/100))) if x == 1 then print(“u got:”, x) end. Ez
@apekz35927 ай бұрын
Let’s say we have a chance of 0.01%, my formula would equate to random(1,10000)
@ZenkaiDragon4007 ай бұрын
I recently began my first game and just so happen to need this rn and u happen to upload this only 4 days ago wow how lucky am i to stumble upon this video thank u 🙏
@azurelava77967 ай бұрын
When you’re using the counter variable while looping through the rarities, this is called prefix sums, and it’s pretty useful for cases like these. But I would say that it’s better to just construct the prefix sums table right after your rarities table is initialized so that you can have faster runtime (especially if there is a lot of rarities).
@Mycrow7 ай бұрын
maybe its just me but could you just run a random function, like between 1 and 1000. then do a bunch of if statements and make then proportional to the rarity. So like common is 90 percent so if the number chosen from the random function was less than or equal to 900 then spawn the common brick? If you could'nt do that directly, you could store it in a variable then do another set of if statements to spawn the brick depending on what the variable is.
@icontrolthefuture6 ай бұрын
Confusing as heck🫠🤦🏾♂️
@wldpnda6 ай бұрын
why not something along the lines of "for [generic item here] : generate number 1 through X, and if that number is 1, give [generic item here]"?
@DevLazl4 ай бұрын
Good video, and your practical use of Module Scripts acts as a separate tutorial itself. Subscribed! This video can help beginners understand many core concepts in Roblox scripting.
@Unicorn0_0CakesАй бұрын
Okay this did it. You have officially gained my me as I paid subscriber to your channel. Fantastic videos my dude!
@slooshified_7 ай бұрын
the way i made a rarity system is more focused on convenience of updating, so instead of making a table or list of rarities i just made a folder containing numberValues and effects of each rarities, so it picks a random number between the lowest and whatever the sum of all values are (all of which are handled by a "ipairs" sequence), which was NOT easy.. but saved me a lot more time adding more and more stuff on it
@flameofthephoenix83957 ай бұрын
1:25 I've never programmed anything on "Roblox" before, but here's probably what I'd do in this situation, create a bunch of pets, none of them are intentionally favored, they are all on equal footing, you'll store on the server a quantity of each of these pets, every day increase the number of every pet by a fixed amount, such as 100 though it depends on how many people are playing your game, each time someone buys it decrease the number of pets, the cost of each pet depends on the number of those pets left compared to the other pets, with it being impossible to buy a pet that is out of stock entirely. Any pet that has far fewer left than all the other pets will get categorized as rare or legendary until it no longer has less than the other pets, you can add sparkles or something to these special pets, you can probably also make it possible to sell pets back if you want to make things more interesting, though it may be best to have a time limit on how long you can have the pet before losing the ability to sell it.
@X5up0_7 ай бұрын
so give everyone the pets and then make a rarity system so they can gamble to get pets that they actually own ?
@flameofthephoenix83957 ай бұрын
@@X5up0_ Nope, the only thing getting pets for free is the server itself, then the server makes the cost of the pets equivalent to how much of that pet is in stock relative to other pets, this naturally will make some pets become harder to get because they happen to be preferred over the other ones for whatever reason, and sometimes the pets will even run out entirely. However, this comment had been made before I finished the video, I misunderstood what he was wanting to do, turns out he just wants some pets to be less likely than others based on hard-coded values.
@X5up0_7 ай бұрын
@@flameofthephoenix8395 well what you are saying makes no sense, the way you are going to code the server getting free pets is actually a rarity system, the only difference between your idea and the video is that you want the legendry pet to be random as well not a hard coded yellow glowing part like in the video, and making the server choose it is also a rarity system which is bad because it could also pick a bad pet and make it "legendry", the only other logical way to do what you said is just making it as a market of pets in the game and the pets rarity is calculated based on revenue of each pet, which is as i said "giving free pets for everyone and then making them gamble using a rarity system to get the pets that they already own" and there is another problem , people won't have enough money to buy the high stats pets and they would for sure buy lower stats pets which kills the whole system there are ways to bypass stuff like this but the only ways i am currently thinking of makes the game not about pets instead about "STONKS"
@Spectre24094 ай бұрын
I don't even code or anything but just the way you explain stuff makes it quite entertaining and fun to watch (even tho I don't understand everything). love it!
@Platinum-Angel7 ай бұрын
As a RNG game developer, I can explain how games add new items with new rarities not adding up to 100% while still being accurate. A first idea I had was to make, for example, common (50%) be added 50x in a table, and all that for each of the rarities, then returning a random one, except that's way too slow for huge numbers like 1,000,000, Roblox risks to crash. But then the ultimate solution is quite quite hard to understand : developers just use a rarity table like in this video, except their random generator function computes each "part"'s rarity weight and return a random part on its weight compared to other ones. Yep, that's quite hard to understand and redo but that's how it works. I spent hours documenting that subject and I made a pretty accurate rng system.
@lonras7 ай бұрын
so first you decide which rarity you get and then you roll what item you get out of the pool of that rarity. Right?
@focuslp5825 ай бұрын
Bro if you did all that work and learned how to do it would you mind helping me out a little so i can understand too ? im tired of all theese indian guys, poor quality vids and ppl without mics. tutorials on that topic are either "how to make a Sols Rng" or just not helpful at all
@PasteurPlaysVideoGames4 ай бұрын
I mean I’m not necessarily a good scripter, but one fault I (think) I find on this video is maybe instead of listing the more rare items first they should list the most common ones first and the count check should be if the randomNum is >= counter (with added weight) that way common is computed first and in most cases the system would not have to go through as many of the rarities as much (I could be wrong tho lol). But then what would you do about rarities that are extremely small like 1 in 100000 since random (as far as I’m aware) doesn’t pick random floats?
@Umbra_Vitae3 ай бұрын
@@PasteurPlaysVideoGamesdivision
@JakubYTchannel7 ай бұрын
me when math.random
@anotherdeadchannel4 ай бұрын
Wait til I tell you that's pseudo random
@Yawnmaster5002 ай бұрын
me when pseudo random
@thingthingthingthingthingthingАй бұрын
@@anotherdeadchanneleverything we know is pseudo random
@crimsonvirgoАй бұрын
What the hell is pseudo random @@anotherdeadchannel
@batatafrita54556 ай бұрын
Idk in roblox studio, but in unity i would just make the machine chose a random int between 1 and a 100, and if its 1 &&
@AC-rx6fr2 ай бұрын
It's the same principle, its just that in his case he looped the if statements instead of writing If randomNun
@thingthingthingthingthingthingАй бұрын
*WHY
@andreyromashchenko89675 ай бұрын
7:00 i swear to god i was gonna stop the video and say how happy i was with your explanation BUT as i was gonna do that you started going weird with renaming “i” and “v” into “rarity” and “weight”. Im a noob at this, so i got confused sooooo much.
@andreyromashchenko89675 ай бұрын
Oh ok, i think i see what you did, you didnt want to keep referring to “i” as to some alphabet letter, you wanted us to see that you refer to the chance of getting the prize. Thats some good teaching. And i was all upset with you and ready to storm out lol. *nervous laughter emoji*
@ryugamiimg3 ай бұрын
Im happy the byteblox is the guy who explain and not the guy say "i not will explain this cuz is complicated"
@newnex_5 ай бұрын
ByteBlox: "Let me talk about todays sponsor" Me: *exits fullscreen to leave video* ByteBlox "Being me" Me: *enters fullscreen again*
@srgato76025 ай бұрын
I know practically nothing about programming even though I'm a bit interested in it, I've never focused on studying it, but I find it very comfortable to watch videos of programmers (more specifically people programming on roblox) teaching mechanics and explaining the codes and how they work.
@vknu6 ай бұрын
I always thought there were basic frameworks that most roblox game devs use to implement somewhat usable rarity systems, depending on the amount of effort the devs put into the game would directly correspond to how well and unique the rarity system would be (If they change the framework that is).
@f_st7 ай бұрын
5:53 - What happens if they do not sum up to 100?
@DaRealEgg4193 ай бұрын
It'll probably give you an error
@Panjy_2 ай бұрын
It’s not an out of 100 chance. If they don’t add to 100 and you don’t change any of the code other than that it will error but if you change the necessary code it won’t be a n/100% chance for each
@QUENTEYY4 ай бұрын
Oh yeah ByteBlox, thank you! You changed my life you opened my eyes! Y- you saved everything that was going wrong in my life!!!
@CarbonMonoxide9117 ай бұрын
I'm no expert but in python id use randint to generate and intiger from 1-100 then put those values to be a random item (For example, if the intiger is 1-80 its commonn, if I get 81-90, its rare, etc.)
@tbwentmia7 ай бұрын
Yeah I was think the same thing
@pickleilyc7 ай бұрын
yea thats basically weightage, not sure why people are so confused on how to do this
@verwelius91704 ай бұрын
For huge amount of items you can premake an array with every possible value of counter assigned to some item for every "table" and then use binary search when you need to pick random thing Its gonna take the same amount of time as its taking to pick random item in the video to premake these arrays But picking random item will be a lot faster (for huge amount of items again)
@Holden_G5 ай бұрын
for rarity, weight in module.rarities do this line will go through the table at random however you can go through the table in ordered index by doing for i = 1, #table do since it uses a numeric loop, we are guaranteed to not have this randomised problem
@bonnaverano45785 ай бұрын
I understood none of that but i got the basic. Basically to make rarity you make something and put numbers on it and the Lowest amount of number is the rarest, and you need to put the item in a file and do coding stuff to make the code function, and if the code has an error you watch this video again
@Umbra_Vitae3 ай бұрын
I mean you’re not wrong I guess lol
@Bol93E7 ай бұрын
1:21 ah yes ,common,undead ,twilight and archangel
@yeahimnotsigma4 ай бұрын
starlight
@JustAnRandomRobloxPlayer3714 ай бұрын
I started learning roblox studio because of you!
@Elqa125 ай бұрын
bro you are amazing! I have been trying to understand this for a while.
@JedotiOffical7 ай бұрын
i saw the text "programming rarity is harder than you think" no its not i made a system right after i saw it to show and it was easy . for all devs that struggle : if you struggle with a rarity system , dont give up (BTW : If something is 1% of 100 % in 1000 drops i got ONLY 9 of them)
@ing327 ай бұрын
Is this actually 1% chance on legendary? I think it's even less? The way you retrieve the object makes me a little confused on the actual percentage. Also this method brings me a lot of memories about greedy programming problems, like the backpack greedy problem.
@byteblox1007 ай бұрын
It’s 1% because every other rarity is retrieved the same way, so the ratio remains the same
@hugomazeo14796 ай бұрын
I programmed rarity in a card game i made, i sorted differente rarities (common, rare, super rare) gave them values, then sorted a random integer between 1-100, depending on witch number it gave some rarity was sorted, then inside that rarity was an array of cards, it randomly choose one of them, that way i could have multiple rarities and many cards inside each rarity, worked perfectly
@D4NONYT7 ай бұрын
1:26 "ReplicatedStorage"
@EpicPico06257 ай бұрын
ReplicatedStorage
@slavsit76007 ай бұрын
ReplicatedStorage
@Quaplex49217 ай бұрын
ReplicatedStorage
@dinoavenger7 ай бұрын
ReplicatedStorage
@lIIllIIIIIlllIIIIlll7 ай бұрын
ReplicatedStorage
@evlsweetblock6 ай бұрын
I'm pretty sure that if you were to use ipairs in your for loop iteration, it will go through the table in order. This can help you combat false positives or gaining a rarity lower than you're supposed to roll. for rarity, weight in ipairs (module.rarities) do --do things end
@Skrvmp7 ай бұрын
Being this early is criminial.. also ur vids r really good.. keep up the good work!!
@solidnywonsz7 ай бұрын
not really
@Skrvmp7 ай бұрын
@@solidnywonsz oh
@thinedave3 ай бұрын
Why the counter variable? I was with you fully until you added that, which just seems unnecessarily complex and harder to implement.
@mxdagamedev5 ай бұрын
U dont need this rarity system, you can just place more of the common parts in the folder, and it's gonna be more common, and legendary will be just, like one, epic 3, rare 5, common 7 i guesss, the more the number of parts, the higher the chance of getting it...
@Axcyantol5 ай бұрын
i mean it depends what rarity system we're talking about, you can use math . random and check if it's between a range with equal or greater/less than and and, or if you're doing something like sols rng you have to do a if math . random = 1 then do for the highest and then do elseif for each lower and lower etc. pretty simple i guess
@twurtle64164 ай бұрын
Do your weights even matter here? Because if it doesn’t go through the table in order the rarities are just completely different to the weights you’ve set
@derby777Ай бұрын
Why don't you just set a rendom variable in a loop than gives a random number between 1 and 1000. Then set if statements that spawn the rarity if the number drawn in between set values eg. Legendary is
@cliphin5 ай бұрын
5:14 that module function is like a struct or class i think so is it?.it seems similar thats why i asked
@neverdaddy7 ай бұрын
Very educational,deserves a sub 🎉
@audrete60717 ай бұрын
short answer: chatgpt, long answer: this video edit: thanks though, i understood the video
@qrzone81677 ай бұрын
You can use your rarity "weight" as the maximum range for math.random and then a successful pull is when your random number is equal to 1. This makes it so you don't have to hand modify your weights every time you decide to add something rarer because adding something rarer just means the new entry will have a bigger weight number.
@KingShepskiy4 ай бұрын
To simplify his system just add ahatever numbers you want and get a loop to count all the numbers meaning the number will be from 1 to any number u want like 157 and it will still work but just have different %
@cayde-6feetunder5314 ай бұрын
I dont know if this is me being dumb or what but sometimes it just stops after 50 or so parts and then refuses to make any more.
@world15837 ай бұрын
i would just give one part a variable that would be random every time the part is created, if the variable is 1 then it would look legendary (change its skin to legendary) and so on. it actually would make you a less messy workspace and you don't need to use a loop
@overlord51103 ай бұрын
“So what exactly happened”
@j.54024 ай бұрын
Wonderful video, just how would I implement this into something like an RNG tycoon game? I just have no idea...
@natsu15256 ай бұрын
i dont code at all, but you made this video interesting so i wanna support you
@ogrum84566 ай бұрын
I did this same code in 6 minutes using only 40 lines without watching the tutorial using only one script, and made it also go between multiple items in each rarity. Programming rarity is easier than you think.
@ogrum84566 ай бұрын
OH and also I was too lazy to do a couple things that would make the code even shorter and more versatile
@valerium7307 ай бұрын
So would that mean that to have an increased chance, you'd just divide by the new luck? For example, before running the table, if you say, had a x2 luck modifier, you'd divide the random number by 2?
@n3o.l17 ай бұрын
Yeah thats basically the idea of it, either dividing the random number by 2 or dividing the weight added to the counter by 2
@woshuabcd3 ай бұрын
I wouldnt have done it like that, i mean its a bit confusing to have numbers attached to rarity like that. I would more define the weight of rarity by the number of chance to it to appear, for instance, common = 50, rare = 25, epic = 10 and legendary = 5 then out of all the possibilities so here 90 common have 50 attributed to it. Hope u find this comment useful and have a nice day !!!😊
@DragonBallDetroit6 ай бұрын
As a game developer there's several ways around this. Well I use unreal engine so it might be different for Roblox.
@alussk7 ай бұрын
You could make a rarity system like he did and make it work by just making it check the first number in the table and if a number is less than the Random number it will get the table index of the rarity and add one to that and check the rarity of the one above the current rarity if that one is equal to or less thAn aswell, if it is less than then it will go to that rarity and check the same until it ends on 1 rarity. If the rarity is not less than the number it will check the next rarity. Bassically just if one number is wrong then go up if one number is right then check the next one if it’s also right and if the next one is wrong it will select the current number. If the number above is right, it will go to that one and check agian.
@Happonyx7 ай бұрын
Basically, this is how you would do it; 1. Generate random number from 1-5 2. If random number is not 5, make rarity common. 3. Else, if random number is 5, generate a new random number from 1 to 10. 4. If random number is not 10, make rarity uncommon. 5. Else, if random number is 10, generate a new number from 1-30. 6. If random number is not 30, make rarity rare. 7. Else, if random number is 30, make rarity legendary. Or, you could do something like this; 1. Generate a random number from 1-100 2. If random number is greater than 50, set rarity to common. 3. If random number is greater than 80, set rarity to uncommon. 4. If random number is greater than 95, set rarity to rare. 5. If random number is 100, set rarity to legendary.
@alussk7 ай бұрын
@@Happonyx i see what you tried to do and this could work however this is pretty bad since you have to manually add in all the numbers yourself which isn't the greatest thing.
@Bextie5 ай бұрын
@alussk that's really not a problem tbh it's just expressing percentage values for the drop rate but if it really is inconvenient to key in the values yourself you could just use a variable to demarcate the bounds between each rarity and easily adjust it from there
@Crab211817 ай бұрын
First, make a folder inside of serverstorage then name it "Things". Second, add a block thats institutional white called "Common" inside of the folder Third, add a block thats camo green called "Uncommon" inside of the folder Fourth, add a block thats electric blue called "Rare" Fifth, add a script inside of serverscriptservice and copy this script: while wait(1) do local chance = math.random(1,2) if chance == 1 then local block = game.ServerStorage.Things.Common end local chance = math.random(1,4) if chance == 1 then local block = game.ServerStorage.Things.Uncommon block.Parent = game.Workspace end local chance = math.random(1,16) if chance == 1 then local block = game.ServerStorage.Things.Rare block.Parent = game.Workspace end end Finally, you can now playtest your new working rarity system.
@jeynicks33982 ай бұрын
u made me understood the chances but I still don't know how luck system is implemented on those chances
@r25-j9e7 ай бұрын
why not just use this? function gamble() for name,chance module.rarity do local rolled = math.random(1,chance) if rolled == chance then return module.parts[name] end end end
@TheEmeraldKidRE7 ай бұрын
Can’t add luck to a system like that since it’s not weighted. Well - you can add luck to the system, but doing so is extremely inefficient since you have to manually remove rarities from the table as luck increases.
@r25-j9e7 ай бұрын
@@TheEmeraldKidRE i don't understand, can u explain more? also how does weighted work
@RyukoPlays7 ай бұрын
@@r25-j9e example 1 weight pet vs 1000 weight pet, the 1000 weight pet has a 1000/1001 chance compared to 1/1001
@erglwrgl7 ай бұрын
Because that isn't really luck that's just picking something random with an equal chance for everything
@r25-j9e7 ай бұрын
@@erglwrgl could u care to explain more about it? for what I see math.random is already luck but I think I'm missing how luck systems work here
@1spark5 ай бұрын
This video inspired me to make a program to prove that Programming Rarity is NOT Harder Than You Think. I was able to make a PHP program that uses less than 50 lines of code and achieved the goal of implementing a rarity system
@FaeTheMf7 ай бұрын
Yo just an idea but could you use multiple random number generators to find rarity so you don’t need to make it up to 100 percent? For example:find random int from 1 in 100. If you don’t get 1, roll 1 in 50. If that fails roll 1 in 10. If they get 1 on any of these rarities then they get the pet associated with that rarity. Then you can have things like 1 in 1 billion without having to worry about any of the math, and if they fail all rolls you can just give them the lowest rarity. This also makes it a lot easier to add 2x luck mechanics etc, even if it’s a bit slow computational wise with too many rarities
@nord51837 ай бұрын
i still see myself as a new dev and i expected to be flabbergasped by the complexity of this script for it to just be extremely easy
@rtbducky6 ай бұрын
So i added one more rarity and the little thingys stopped spawning. I added the ["mythic"] in the module script and set it to 0.5% and i adjusted the common so its 49.5. and i also made math random (0.01 ,100) idk what i did wrong can anyone help?
@waterless_sponge3 ай бұрын
Some people are so lazy at doing that and just give you common all the time There's no way to get a higher rarity no matter what like, there is a game i played i dont remember what but its a gacha that spins and lets you see all the things, i manage to land it on legendary but then it switched the pointer to a common like, they didn't even try to hide it, it's so obvious that they dont want you to get it cuz the spin is slow when it landed to legendary but then it did a quick spin that perfectly lands to the common.
@RealDB7 ай бұрын
sol's rng dev gonna call himself a developer after he realizes people will think coding rng is hard
@MidasLich6 ай бұрын
he is a developer though
@NauLeah5 ай бұрын
When it says “0.5% chance” you actually just make it a 2% chance so it makes your players feel more lucky and get a gambling addiction
@Adriel_Idea6 ай бұрын
thanks for teaching me how to make gambling
@tummy39507 ай бұрын
Please make a tutorial on how to level up your Scriptingan I have been stuck on third tomoe for a year now
@lazerouskyle5 ай бұрын
So Legendary being advertised as 1/100 isn't actually 1/100. If the system doesn't check in order, it will be 1/4 on top. Meaning it's actually 1/400. Does that sound right? So in conclusion, this is not how rarities are supposed to work.
@VXlow5 ай бұрын
Yeah, Probability doesnt make sense when rblx games uses rng properties if you studied chances and probabilities.
@6tobi6hana67 ай бұрын
Can you do it by picking a number 1 to 100 and then like if number is 1 then return legendary and if the number is 2-20 it will return epic and so on?
@byteblox1007 ай бұрын
Yeah, another option would just be to continually check if the number is less than 100, then less than 50, then less than 30, and so on. I do this exact system in my “1 hour game” video I believe
@donqui17017 ай бұрын
what if in the chooseRandomPart you just do if randomNum == 1 do..., elseif 2 =< randomNum =< 19 do ... elseif 20 =< randomNum =< 29 do... etc wouldn't it work too ? i never coded on roblox studio
@basicaccount1396 ай бұрын
bro thanks this was mad helpful (I don't do coding, I don't know why I watched this)
@topsnag6 ай бұрын
Don’t know anything about scripting but this video was entertaining
@Dr.Callaham7 ай бұрын
The only reason why i would make a rarity system is to make a rotation shop with cosmetic items. As pet sim, blade ball and sols rng is basically gambling glorified Edit: Well because it looks like some of sols rng players are going after me in the comment, i want to clarify that i dont think that sols rng is gambling, and that pet sim and blade ball is the roblox casino. But what makes me group the game up with the others are that sols rng enforces the gambling mentality that the next one could be the super good reward. This could create a habbit in children which could lead to them resorting to gambling later in life. This is also not something that i feel like sols rng is doing, but basically all popular roblox games nowadays.
@diablense7 ай бұрын
Gambling🤤🤤🤤 Nah, in this case sole rng is kinda valid compared to others bc all you can get in this "game" is cosmetic auras that give literally 0 things
@Dr.Callaham7 ай бұрын
@@diablense you say that while in sols rng, you try and get lucky to get those super rare auras. While things like slot machines you hope that you get lucky and get a super rare combination of icons to win big. There quite alot of similarities belive it or not
@diablense7 ай бұрын
@@Dr.Callaham compared to pet sim and blade ball, rng things here do not give any advantages, they are only visual, even tho this is literally the ONLY "gameplay" of "game" it's still not as bad as in pet sim.
@Dr.Callaham7 ай бұрын
@@diablense never said it wasnt, and i completely agree. However that does not mean that sols rng has no effects on peoples minds.
@glorioup7 ай бұрын
@@Dr.Callahamsols rng isn’t gambling. If you take the definition of gambling, it’s to “risk” something for a game of chance. But in sols rng you aren’t risking anything, there’s no punishment because quite frankly there’s no further gameplay or meaning over showing to others how much you’ve wasted your time with a colorful aura that gives enough dopamine to excite the developing baby brains of it’s playerbase.
@Simo-dm1zd7 ай бұрын
scripting a rarity system is easy tbh, the real difficulty is scripting a LUCK system inside the rarity one
@solderet_wav7 ай бұрын
depends how u want luck to work. personally the luck system that would make the most sense is by factors like if u have a rarity thats 25 and ur luck is 25 then that rarity becomes guaranteed and whatever the previous rarity is, is pretty much voided.
@thingthingthingthingthingthingАй бұрын
Just use some math
@admiralwastaken7 ай бұрын
i hate it when my pets have spikes and machine guns attached to them, it happens every time
@adenrockss7 ай бұрын
its easier to make common 100 - all of the other raritys. if you do that its seamless when implementing new raritys into the game
@PaladinianDaGoat5 ай бұрын
I watched this without a single coding knowledge but surprisingly I didnt understand how a single thing works! (good video tho😭)
@EaZea7 ай бұрын
As someone who has made my yeah rng game I can tell you that you’re making it sound a lot harder than it actually is lol The only mistake I’d actually watch out for is floating point precision stuff when the rarities are low. That’s when I ran into issues myself. Anyway it’s literally just simple math but you yapped for views
@solderet_wav7 ай бұрын
have you tested it with numbers that go up to 1e308? How are you doing luck system for yours?
@EaZea7 ай бұрын
@@solderet_wav i add up all the probabilities and then they roll a random number between 0 and the sum. the luck works by the sum minus the number they rolled by 1 minus the luck value and adding that onto their original roll
@soulbounddoll18267 ай бұрын
Screw it, low tier items are ultra rare like a bee in alaska and high tier items are like rocks in a quarry.
@beesechurger14 ай бұрын
Programming rarity is easy clearly lol, I’ve literally programmed rarity in a Pygame in a few lines. Importing math, getting random number, then deducting if random number is less than 100 it’s common, less than 30 it’s rare etc. takes like 10 lines of code
@Lipaanek7 ай бұрын
I can confirm that, it was brutal and at the end I must use tutorial!
@SGamingYoutubeАй бұрын
then big games aggressively put 0.0000001 rarity chance for titanic pet
@Rimooooo4 ай бұрын
Quitting gambling is pretty hard too.
@polyneptic7 ай бұрын
you don't need to make your rarity weights total up to 100, but instead just do math.random(1, [sum of all your weights]) for your random number instead of 1 - 100.
@markie103835 ай бұрын
im watching this in front of my friends with no programming knowledge whatsoever in order to suffice for my self esteem as the smart guy in the friend group
@dradekon7 ай бұрын
you are an inspiration byteblox
@byteblox1007 ай бұрын
Thanks pookie 😘
@theearthisphlat6 ай бұрын
New to Programming in general, figured id give it a shot for fun. ive got my entire two scripts coded exactly like shown in the video yet it wont spawn any bricks of ANY rarity. Anybody know why? im assuming im missing something very obvious lol, ive paid heavy attention to case sensitivity and efficient naming
@Noob-ot8rf7 ай бұрын
ill be honest, i never considered this hard as i knew for a long time how weight/cost works for randomization
@djmonk_5 ай бұрын
Dude in the background of this video i keep hearing this like old voice saying "where did the time go" and i am scared i haave shizophrenia