Programming Rarity is Harder Than You Think

  Рет қаралды 83,385

ByteBlox

ByteBlox

18 күн бұрын

50% OFF COUPON WITH "SUSBYTE" (ends in 3 days):
linktr.ee/ByteBlox
discord: / discord
wondered how to make a main menu in roblox studio? or how to create a shop which has working GUI? ive made lots of 2024 roblox scripting tutorials about all the different bits of roblox to give you some up-to-date information about all of its properties and events.
my goal is to simply give some insight on how to use the various features and instances roblox studio, and show you some fun stuff you can do with them. thanks for checking out this roblox scripting tutorial :)

Пікірлер: 436
@byteblox100
@byteblox100 15 күн бұрын
Adding new course units soon, buy now to get them for FREE: linktr.ee/ByteBlox
@awesomesauce-kg9xn
@awesomesauce-kg9xn 15 күн бұрын
Change your name to freakyblox now
@hqTheToaster
@hqTheToaster 15 күн бұрын
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.)
@grindhub8340
@grindhub8340 15 күн бұрын
FreakyBlox
@summonandthe8127
@summonandthe8127 15 күн бұрын
e
@cozzy124
@cozzy124 15 күн бұрын
day 6 of asking byteblox to release an onlyfans
@eclair1616
@eclair1616 15 күн бұрын
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.
@maddestcattest
@maddestcattest 15 күн бұрын
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.
@eclair1616
@eclair1616 15 күн бұрын
@@maddestcattest 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.
@Avysilvasan
@Avysilvasan 15 күн бұрын
gimme oux
@ivoxii
@ivoxii 14 күн бұрын
@@eclair1616they get 30% not 70%
@azurelava7796
@azurelava7796 14 күн бұрын
@@ivoxiiWell 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%.
@ZaeNonQ
@ZaeNonQ 15 күн бұрын
me when i use "pick random from 1 to 100" in scratch:
@eclair1616
@eclair1616 15 күн бұрын
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)
@officialcbyt
@officialcbyt 15 күн бұрын
@@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
@opa8012
@opa8012 15 күн бұрын
@@eclair1616 also he never even said anything about a programming language
@keppelin1527
@keppelin1527 15 күн бұрын
J
@neonstix1035
@neonstix1035 15 күн бұрын
@@eclair1616it is, it’s block coding. Even unreal engine has block coding.
@LLukasVx
@LLukasVx 15 күн бұрын
1:26 yes, replicatedstorage
@hqTheToaster
@hqTheToaster 15 күн бұрын
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.)
@NaraSherko
@NaraSherko 15 күн бұрын
I did for a iq rng game
@summonandthe8127
@summonandthe8127 15 күн бұрын
ýes
@CrazyDoodEpicLeaves
@CrazyDoodEpicLeaves 15 күн бұрын
@@NaraSherko The concept of a "IQ RNG" game is so ironic, because only dumbasses would play it
@SunnyNightsStudios
@SunnyNightsStudios 15 күн бұрын
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
@hqTheToaster
@hqTheToaster 15 күн бұрын
@@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.
@alpha4194
@alpha4194 12 күн бұрын
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
@alpha4194
@alpha4194 12 күн бұрын
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_Prophet
@Godsent_Prophet 12 күн бұрын
You eradicating the redundant roblox tutorials with the one
@Noob-ot8rf
@Noob-ot8rf 11 күн бұрын
fr i put both together in a table inside the main table instead of making the index a string
@PeterMyler
@PeterMyler 10 күн бұрын
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
@alpha4194
@alpha4194 10 күн бұрын
@@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
@slooshified_
@slooshified_ 15 күн бұрын
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
@ZenkaiDragon400
@ZenkaiDragon400 10 күн бұрын
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 🙏
@SuppressedMountain
@SuppressedMountain 13 күн бұрын
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
@DpJordi
@DpJordi 6 күн бұрын
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.
@azurelava7796
@azurelava7796 14 күн бұрын
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).
@Mycrow
@Mycrow 18 сағат бұрын
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.
@Platinum-Angel
@Platinum-Angel 8 күн бұрын
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.
@neverdaddy
@neverdaddy 19 сағат бұрын
Very educational,deserves a sub 🎉
@Hermit_Wish
@Hermit_Wish 15 күн бұрын
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.
@azurelava7796
@azurelava7796 14 күн бұрын
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_Wish
@Hermit_Wish 14 күн бұрын
@@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_Wish
@Hermit_Wish 14 күн бұрын
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).
@apekz3592
@apekz3592 7 күн бұрын
local x = random(1,round(1/(rarity/100))) if x == 1 then print(“u got:”, x) end. Ez
@apekz3592
@apekz3592 7 күн бұрын
Let’s say we have a chance of 0.01%, my formula would equate to random(1,10000)
@JedotiOffical
@JedotiOffical 13 күн бұрын
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)
@D4NONYT
@D4NONYT 15 күн бұрын
1:26 "ReplicatedStorage"
@EpicPico0625
@EpicPico0625 15 күн бұрын
ReplicatedStorage
@slavsit7600
@slavsit7600 14 күн бұрын
ReplicatedStorage
@ninjaventures4921
@ninjaventures4921 14 күн бұрын
ReplicatedStorage
@dinoavenger
@dinoavenger 14 күн бұрын
ReplicatedStorage
@skilledmemoryroblox
@skilledmemoryroblox 14 күн бұрын
ReplicatedStorage
@chaosincursion
@chaosincursion 6 күн бұрын
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
@Mcreedity
@Mcreedity 15 күн бұрын
Oh my glorious king ByteBlox are you going to do the thug shaker i have been waiting for so long
@kilex3471
@kilex3471 15 күн бұрын
Ah he used chatgpt for this
@byteblox100
@byteblox100 15 күн бұрын
No lmao, it was part of my course
@depravedsouls9975
@depravedsouls9975 4 күн бұрын
Shit, I made an entire game based solely off chatgpt
@kilex3471
@kilex3471 4 күн бұрын
@@depravedsouls9975 By based off you mean only using it right? if so then thats a completely viable option. chatgpt is very useful for that sort of stuff as long as you know a little bit about scripting, if you cant code at all you wouldnt be able to identify any errors or tell chatgpt what its problem was and how to fix it, i even use both chatgpt and the assistant. I find the assistant is amazingly good at bug fixing and optimizing code or doing tasks that chatgpt seems unable to do correctly since it can be completely stupid sometimes.
@qrzone8167
@qrzone8167 4 күн бұрын
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.
@Lipaanek
@Lipaanek 19 сағат бұрын
I can confirm that, it was brutal and at the end I must use tutorial!
@kale1209
@kale1209 2 күн бұрын
i never thought of this being difficult damn, whenever I've had to program it I've just kind of done it without thinking bc its not that hard
@flameofthephoenix8395
@flameofthephoenix8395 8 күн бұрын
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_
@X5up0_ Күн бұрын
so give everyone the pets and then make a rarity system so they can gamble to get pets that they actually own ?
@flameofthephoenix8395
@flameofthephoenix8395 Күн бұрын
@@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_
@X5up0_ 20 сағат бұрын
​@@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"
@petitcoke
@petitcoke 11 сағат бұрын
What software are you using to code this in?
@alussk
@alussk 14 күн бұрын
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.
@Happonyx
@Happonyx 6 күн бұрын
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.
@alussk
@alussk 6 күн бұрын
@@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.
@CarbonMonoxide911
@CarbonMonoxide911 8 күн бұрын
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.)
@tbwentmia
@tbwentmia 3 күн бұрын
Yeah I was think the same thing
@pickleilyc
@pickleilyc 12 сағат бұрын
yea thats basically weightage, not sure why people are so confused on how to do this
@FrogsAreGods
@FrogsAreGods 12 күн бұрын
instead store a value of numbers that it has to be greater than and generate a random number from 1-100 store it as randomValue or something then loop through from legendary to common (must be in that order to ensure your probobabilties are acurate) checking if the value of each is greater less than randomValue so you would start to check if it was 100 (only number it could generate greater than 99) and go on untill 0
@user-zs1hm1cy8u
@user-zs1hm1cy8u 14 күн бұрын
if table order is not waranteed then dont return a value at that point. Instead, store the value and keep iterating
@Dr.Callaham
@Dr.Callaham 15 күн бұрын
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.
@diablense
@diablense 15 күн бұрын
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.Callaham
@Dr.Callaham 15 күн бұрын
@@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
@diablense
@diablense 15 күн бұрын
@@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.Callaham
@Dr.Callaham 15 күн бұрын
@@diablense never said it wasnt, and i completely agree. However that does not mean that sols rng has no effects on peoples minds.
@glorioup
@glorioup 15 күн бұрын
@@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.
@valerium730
@valerium730 9 күн бұрын
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.l1
@n3o.l1 4 күн бұрын
Yeah thats basically the idea of it, either dividing the random number by 2 or dividing the weight added to the counter by 2
@Pygim
@Pygim Күн бұрын
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.
@Crab21181
@Crab21181 5 күн бұрын
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.
@LisooYT
@LisooYT 8 күн бұрын
i actually use set {_num} to random integer between 1 and 1000 if {_num} is between 1 and 100: do something its about 10% cause 1/1000 is 0.001 which is 0.1% 10 is 1% 100 is 10% and 1000 is 100% so yeah
@f_st
@f_st Күн бұрын
5:53 - What happens if they do not sum up to 100?
@Noob-ot8rf
@Noob-ot8rf 11 күн бұрын
ill be honest, i never considered this hard as i knew for a long time how weight/cost works for randomization
@ing32
@ing32 7 күн бұрын
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.
@byteblox100
@byteblox100 6 күн бұрын
It’s 1% because every other rarity is retrieved the same way, so the ratio remains the same
@audrete6071
@audrete6071 13 күн бұрын
short answer: chatgpt, long answer: this video edit: thanks though, i understood the video
@Simo-dm1zd
@Simo-dm1zd 14 күн бұрын
scripting a rarity system is easy tbh, the real difficulty is scripting a LUCK system inside the rarity one
@vyntax.mp3
@vyntax.mp3 6 күн бұрын
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.
@tummy3950
@tummy3950 13 күн бұрын
Please make a tutorial on how to level up your Scriptingan I have been stuck on third tomoe for a year now
@vyntax.mp3
@vyntax.mp3 6 күн бұрын
theres a better way to do it to have it guarantee a certain rarity based on luck and it can support numbers up to 1e308. I have my own pseudo number generator that doesnt use roblox’s random library though. Personally this method is better than weights
@adenrockss
@adenrockss 4 күн бұрын
its easier to make common 100 - all of the other raritys. if you do that its seamless when implementing new raritys into the game
@rocketpadgamer
@rocketpadgamer 12 күн бұрын
I had to make an item that gives you one of 7 items with equal odds, plus one that has a 2% chance of spawning I did it by putting all of them except the rare item in a table, then I made a random number generator that picks a number from 1 to 100, if the result is above 98 then it picks the rare item, else it picks one of the random common items
@willtogs
@willtogs 12 күн бұрын
wouldn't it be easier to do something like a random number event happen via player and then make a series of if elseif statements? like are there any downsides to doing it like so? Sorry if its a dumb question, just curious :))
@Godsent_Prophet
@Godsent_Prophet 12 күн бұрын
having a huge chain of elseif statements is incredibly inefficient and its a really bad thing to develop as a habit, utilizing tables makes things *way* easier and it's not as annoying to manage in the longrun
@willtogs
@willtogs 12 күн бұрын
@@Godsent_Prophet I see, thanks!! I didnt consider that adding more rarities would very much inflate the code lol, thanks again
@yuu1583
@yuu1583 15 күн бұрын
hey byte, I was thinking to buy your course but idk what I can learn and what I can do with your course, I'll be able like, to make a... simple game of combat, or maybe an advanced?
@byteblox100
@byteblox100 15 күн бұрын
The other commenter has some legit points, but the course is basically just a way for beginners to get fully accustomed to the necessary parts of Roblox scripting (remotes, datastore, gui, etc). It’s there if you want to save time and get everything in one package instead of having to scout for tutorials. People say I misunderstand things but that’s only because my top videos have been somewhat rage bait lmao. The course itself is fully accurate
@flamescope9554
@flamescope9554 14 күн бұрын
@@byteblox100 kinda unprofessional for you to respond this way. chefs are not really comparable because you're trying to teach how to script, not write a better script for them.
@byteblox100
@byteblox100 14 күн бұрын
@@flamescope9554 KZbin tutorials also aren’t trying to write better scripts. My point is that with a chef, you’re paying for the time it took them to make something that could give you value
@flamescope9554
@flamescope9554 14 күн бұрын
@@byteblox100 Yeah thats my point, the chef isn't trying to teach you how to cook but your tutorials are trying to teach you how to script. (I was a bit unclear and I do understand your point I just thought the analogy with the chef wasn't all that comparable)
@theancientone3891
@theancientone3891 9 сағат бұрын
local randomNum = math.random(1, 100) If randomNum = 1 then return legendary elseif randomNum >= 2 and randomNum = 20 and randomNum
@byrey3
@byrey3 4 күн бұрын
Why don't you just check for the rarity weight alone?? for rarity,weight in module.rarities do if randomNum
@Benary-1
@Benary-1 6 сағат бұрын
what about just taking a random number, between 1-100, then if it is greater or equal to 100, it is legendary, elif it is greater or equal to 85 it is epic and so on?
@Therian4Life1573
@Therian4Life1573 6 күн бұрын
I thought it was going to be simple and it was somehow even simpler than I anticipated... this is like, babies first coding class
@soulbounddoll1826
@soulbounddoll1826 21 сағат бұрын
Screw it, low tier items are ultra rare like a bee in alaska and high tier items are like rocks in a quarry.
@khoibut6206
@khoibut6206 8 күн бұрын
I'm here before watching the video. Im a cs student currently and have really good cp skills (1934 cf rating) and my toxic trait is thinking this is piss easy. But things will get interesting with the extremely high rarity like 1 in a quintillion but i still think it is not that hard. Please humble me
@6tobi6hana6
@6tobi6hana6 12 күн бұрын
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?
@byteblox100
@byteblox100 12 күн бұрын
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
@eGasCode
@eGasCode 15 күн бұрын
if i heard you right then this rarity technique is not precise and could be unfair (not sure tho) is there a way to perfectly sort the rarities so its always very precise the same and fair?
@byteblox100
@byteblox100 15 күн бұрын
Technically you could make the table sorted by doing a number loop and then making a rarity table and going through the table using those numbers and then implement a system where the number is checked whether it’s in range of the allowed numbers and blah blah blah blah blah It would just be extra work for a system that’s effectively the same rarity system, albeit with more random steps
@user-ox7ir1lu4y
@user-ox7ir1lu4y 3 күн бұрын
orrr ‘hey chat gpt. make me a rarity system.’ or even better ‘teach me how to make a rarity system’
@alsoaspect
@alsoaspect 14 күн бұрын
pls make an RNG game where the better rarity you have, the better you are than everyone, for example if you have a better rarity you might be faster or get weapons or maybe even admin powers
@SheekyDev
@SheekyDev 5 күн бұрын
Wait what? Adding rarities is hard? Man… I guess it is hard then… felt simple for me, but idk, maybe because I read a rarity thing a few years ago, and it’s just engrained in my mind now.
@waterymonkey
@waterymonkey 6 күн бұрын
i feel so intelligent after i correctly predicted what you did
@emolingo_real
@emolingo_real 15 күн бұрын
Being this early is criminial.. also ur vids r really good.. keep up the good work!!
@solidnywonsz
@solidnywonsz 15 күн бұрын
not really
@emolingo_real
@emolingo_real 15 күн бұрын
@@solidnywonsz oh
@TacoEric
@TacoEric 14 күн бұрын
all you need is knowing basic statistics and use random numbers
@Bol93E
@Bol93E 4 күн бұрын
1:21 ah yes ,common,undead ,twilight and archangel
@yourdevflaw
@yourdevflaw 15 күн бұрын
well what can i say? i was just thinking on how i could make a rarity system for my crate opening system. thanks
@polyneptic
@polyneptic 7 күн бұрын
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.
@Wyrmver
@Wyrmver 14 күн бұрын
that feels kinda icky even tho you got a 1 on the random number you only have a 1/4 chance of actually getting the legendary
@Doopie2008
@Doopie2008 6 күн бұрын
well guided ❤
@marty2035
@marty2035 15 күн бұрын
Once I made a Priority System to spawn ores. It worked pretty well.
@ReaISepiroth
@ReaISepiroth 15 күн бұрын
rex reincarnated
@marty2035
@marty2035 15 күн бұрын
@@ReaISepiroth Nah, the game isn't public.
@danielmain1885
@danielmain1885 Күн бұрын
or you can do this if math.Random(1, your chance) == 1 then --what to do end
@lunaticnomad0
@lunaticnomad0 15 күн бұрын
Now I get why you think coding this is hard, and I agree.
@justanormalplayer442
@justanormalplayer442 11 күн бұрын
Couldn’t you just put a value in each part and get a table and the bigger the number the amount of copies will be added to the table? (And then obviously choose a random part from the table)
@justanormalplayer442
@justanormalplayer442 11 күн бұрын
Atleast that’s how I tackled rng
@imoctavs
@imoctavs 10 күн бұрын
Video title: programming rairity is harder than you think Video: *T A B L E S .*
@genericalt9746
@genericalt9746 Күн бұрын
no it itsnt u just make it go backwards from most rare to least eg aura one gets rolled for 1/1mil if u get 1 u get that aura if no move on to aura 2 1/1000 and then if none are rolled u do common
@Garbaige
@Garbaige 15 күн бұрын
4 mins this time lol still good luck tho i dont even have notifications on i just hoped on my home page lol
@dradekon
@dradekon 15 күн бұрын
you are an inspiration byteblox
@byteblox100
@byteblox100 15 күн бұрын
Thanks pookie 😘
@user-cb2ne4si6x
@user-cb2ne4si6x 11 күн бұрын
What does AAA game mean? Does it mean that when someone gets good stuff they say “AAAAAAAAAAAA!!!!!!!”?
@KanYT
@KanYT 11 күн бұрын
Meanwhile python
@admiralwastaken
@admiralwastaken 15 күн бұрын
i hate it when my pets have spikes and machine guns attached to them, it happens every time
@Breuhh
@Breuhh 6 күн бұрын
But how do you make luck potions? What even does luck
@maggogieraffe3296
@maggogieraffe3296 15 күн бұрын
I have coded a rarity system after 1 year of programming lol on my own
@RealDB
@RealDB 3 күн бұрын
sol's rng dev gonna call himself a developer after he realizes people will think coding rng is hard
@EaZea
@EaZea 7 күн бұрын
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
@vyntax.mp3
@vyntax.mp3 6 күн бұрын
have you tested it with numbers that go up to 1e308? How are you doing luck system for yours?
@EaZea
@EaZea 2 күн бұрын
@@vyntax.mp3 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
@user-jc3jn6uz5i
@user-jc3jn6uz5i 15 күн бұрын
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
@TheEmeraldKidRE
@TheEmeraldKidRE 15 күн бұрын
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.
@user-jc3jn6uz5i
@user-jc3jn6uz5i 15 күн бұрын
@@TheEmeraldKidRE i don't understand, can u explain more? also how does weighted work
@RyukoPlays
@RyukoPlays 15 күн бұрын
@@user-jc3jn6uz5i example 1 weight pet vs 1000 weight pet, the 1000 weight pet has a 1000/1001 chance compared to 1/1001
@insertusernamehere8125
@insertusernamehere8125 15 күн бұрын
Because that isn't really luck that's just picking something random with an equal chance for everything
@user-jc3jn6uz5i
@user-jc3jn6uz5i 15 күн бұрын
@@insertusernamehere8125 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
@PrinceKMartires
@PrinceKMartires 12 күн бұрын
Maybe use: local rarity = 0.01 -- put how rare you want it to be if math.random() < rarity then -- do something end
@TheNotKnown0ne
@TheNotKnown0ne Күн бұрын
bruh just make a random number generator, then if the number from 0 to 50 - common, 51 to smth - rare, smth+1 to smth2 - epic, smth2+1 to 100 - legendary...
@emmettdja
@emmettdja 4 күн бұрын
I missed the part where this was supposed to be difficult
@LateralOrc69977
@LateralOrc69977 4 күн бұрын
Can you do admin commands
@l2v498
@l2v498 7 күн бұрын
bro summarized sols rng's code in one vid
@Alex-jx3if
@Alex-jx3if 9 күн бұрын
not gonna lie I thought when you said it is muuuuuch harder I thought that it was but it's exactly how python works
@Duck-up5tb
@Duck-up5tb 15 күн бұрын
@byteblox100 you NEED to make a video on the _G function, it literally saves so much time and is so much easier to understand than module scripts!! Everyone get his attention on this
@mageninjaballer1449
@mageninjaballer1449 9 күн бұрын
it’s basically like, get everything. So _G.Part Op fr
@Melmelinda176OS
@Melmelinda176OS 9 сағат бұрын
pls be my Math teacher 🙏 ur explanation is so goodd
@OrganicMilkGang
@OrganicMilkGang Күн бұрын
for me rarity was kinda easy but everyone has their own problems
@sparkywolfy8978
@sparkywolfy8978 13 күн бұрын
Here’s one unique thing to do if anyone wanted to do a higher rarity chance: Let’s say you want Legendary to be (1 in 750k) and Epic to be 4.5% chance, basically calculate 750,000 * 0.045 OR (750,000 / 100) * 4.5 … (EDIT: You might want to use math.floor to round up the number if it has decimals e.g. 45.291736) To make it easier to add all together in the module.rarities, make a for loop that will add all the values up as a sub total. local subtotal = 0 for i = 1, #module.rarities do subtotal += module.rarities[i] end And just chance the code on Line 19 to… local randomNum = math.random(1, subtotal)
@gamewithog
@gamewithog 14 күн бұрын
oh yea byte, You changed my life…. You opened my eyes…. 👀 You saved everything that was going wrong in my life… That’s why today i will buy your course🔥😇
@gamewithog
@gamewithog 14 күн бұрын
byteblox*
@breadbeee
@breadbeee 15 күн бұрын
i just use a wheel system with a table lol
@DarkzoneDiamond
@DarkzoneDiamond 15 күн бұрын
The system I would use would be something like: Local rarities = { Common = {prob = 1/2} Uncommon = {prob = 1/4} Rare = {prob = 1/8} } Local function getranditem(table) number = math.random() for i in pairs(table) do cumalprob = cumalprob + i.prob if number
@GumbiOfficial
@GumbiOfficial 15 күн бұрын
eh, i do something similar.
@primitivecereal
@primitivecereal 15 күн бұрын
homie didn’t even try with the syntax
@Noob-ot8rf
@Noob-ot8rf 11 күн бұрын
this is almost exactly what i use
@treepert4155
@treepert4155 4 күн бұрын
Me at 8th grade " so basicallly you can give me kitusne fruit right :D"
@shoes4clues955
@shoes4clues955 4 күн бұрын
that title is 100% misleading, you can pretty easily program rarities in like 5 minutes by just using conditionals and a single random number
@King_sobb
@King_sobb 2 күн бұрын
No bcuz every item has the same chance of being picked.
@shoes4clues955
@shoes4clues955 2 күн бұрын
@@King_sobb ??? lemme write it in pseudo code if(num
@anikinmartinez4726
@anikinmartinez4726 10 күн бұрын
instead of picking a number up to 100, just pick a random number up to the total weight
@derrrick1407
@derrrick1407 Күн бұрын
It’s 100 because his rarest is 1 in a hundred
@feathersm7966
@feathersm7966 4 күн бұрын
How is Rarity hard in any shape or form its literally just weighted randomness/gaussian distribution
@ayanhaq2584
@ayanhaq2584 8 сағат бұрын
Me not using the "random" library in python to choose a random number
@leonoraarocho658
@leonoraarocho658 9 күн бұрын
pick random 1 to 100 from scratch: greater than or lesser than:
@SandboxPBuilder
@SandboxPBuilder 15 күн бұрын
Scripting rarities is ez. Just make a table and loop through them. And use math.random for each of those elements
@SandboxPBuilder
@SandboxPBuilder 15 күн бұрын
Also u can use tables in tables so u dont need 2 seperate tables
@vyntax.mp3
@vyntax.mp3 6 күн бұрын
thats great and all. now script luck with it lol
@FWS_Sinister
@FWS_Sinister 14 күн бұрын
honestly i wouldve just generated a number then check if in range for each rarity lol
Why Don't More Games Have "Team-Based" Abilities?
7:44
ByteBlox
Рет қаралды 15 М.
I Learned How to SCRIPT in 7 Days | Roblox
11:00
Simjet
Рет қаралды 15 М.
Bro be careful where you drop the ball  #learnfromkhaby  #comedy
00:19
Khaby. Lame
Рет қаралды 32 МЛН
I PEELED OFF THE CARDBOARD WATERMELON!#asmr
00:56
HAYATAKU はやたく
Рет қаралды 37 МЛН
We Survived 100 Days in 1.21 Minecraft Hardcore...
26:30
Blooh
Рет қаралды 246 М.
Turning an Optical Illusion Into a Playable Character
22:39
ByteBlox
Рет қаралды 301 М.
Exploits Are EASY to Fix, People Are Just Lazy
11:42
ByteBlox
Рет қаралды 216 М.
DON'T Make a Roblox Game Without Watching This First.
27:20
SmartyRBX
Рет қаралды 405 М.
3 Hours vs. 3 Years of Blender
17:44
Isto Inc.
Рет қаралды 3,2 МЛН
How many visits will immersive ads get me on Roblox?
25:47
Cookie Tech
Рет қаралды 229 М.
Mojang just changed Pistons forever. And people hate it.
4:06
Phoenix SC
Рет қаралды 1,4 МЛН
Why I Hate The New Roblox Avatars
8:34
ByteBlox
Рет қаралды 35 М.
Making a game about lil guys is fun and hard
12:10
Radnyx
Рет қаралды 29 М.
Результат невероятен🤯
0:39
Бутылочка
Рет қаралды 3,7 МЛН
Как правильно пить баблти🤔
0:51
BLACK OCEAN
Рет қаралды 10 МЛН
Современные пираты 🤯
0:19
WORLDruNEWS
Рет қаралды 3 МЛН
УМНЫЙ НОЧНИК #shorts
0:48
Fast Family LIFE
Рет қаралды 1,1 МЛН
Cute Barbie gadgets 🩷💛
1:00
TheSoul Music Family
Рет қаралды 42 МЛН