Тёмный

Programming Rarity is Harder Than You Think 

ByteBlox
Подписаться 72 тыс.
Просмотров 269 тыс.
50% 1

get my full Roblox Studio course here:
linktr.ee/Byte...
insta (i have cool pigeon photos): / subnautica_man
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 :)

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 707   
@byteblox100
@byteblox100 4 месяца назад
Adding new course units soon, buy now to get them for FREE: linktr.ee/ByteBlox
@awesomesauce-kg9xn
@awesomesauce-kg9xn 4 месяца назад
Change your name to freakyblox now
@hqTheToaster
@hqTheToaster 4 месяца назад
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 4 месяца назад
FreakyBlox
@summonandthe8127
@summonandthe8127 4 месяца назад
e
@cozz124
@cozz124 4 месяца назад
day 6 of asking byteblox to release an onlyfans
@eclair1616
@eclair1616 4 месяца назад
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.
@MaddestCattestGaming
@MaddestCattestGaming 4 месяца назад
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 4 месяца назад
@@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.
@Avysilvasan
@Avysilvasan 4 месяца назад
gimme oux
@i0x37
@i0x37 4 месяца назад
@@eclair1616they get 30% not 70%
@azurelava7796
@azurelava7796 4 месяца назад
@@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%.
@Panjy_
@Panjy_ 2 месяца назад
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.
@kurmeklis8412
@kurmeklis8412 13 дней назад
nuh uh
@Panjy_
@Panjy_ 13 дней назад
@@kurmeklis8412 yuh huh
@yhnah1329
@yhnah1329 11 дней назад
​@@kurmeklis8412 Math
@chaosincursion
@chaosincursion 4 месяца назад
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
@anasdari6074
@anasdari6074 Месяц назад
its easy legendary = math.random1,100
@RelixEnd
@RelixEnd 15 дней назад
@@anasdari6074 no lol. you would need to make it so if the number is = 100 then legendrary else other ones
@hqTheToaster
@hqTheToaster 4 месяца назад
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 4 месяца назад
I did for a iq rng game
@summonandthe8127
@summonandthe8127 4 месяца назад
ýes
@CrazyDoodEpicLeaves
@CrazyDoodEpicLeaves 4 месяца назад
@@NaraSherko The concept of a "IQ RNG" game is so ironic, because only dumbasses would play it
@SunnyNightsStudios
@SunnyNightsStudios 4 месяца назад
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 4 месяца назад
@@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.
@Pygim
@Pygim 4 месяца назад
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.
@DpJordi
@DpJordi 4 месяца назад
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-jl4sh
@Gogo-jl4sh 2 месяца назад
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.
@Tealen
@Tealen 2 месяца назад
5 scripts is too much no?
@DpJordi
@DpJordi 2 месяца назад
@@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.
@Tealen
@Tealen 2 месяца назад
@@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.
@DpJordi
@DpJordi 2 месяца назад
@@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.
@azurelava7796
@azurelava7796 4 месяца назад
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 4 месяца назад
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.
@icontrolthefuture
@icontrolthefuture 3 месяца назад
Confusing as heck🫠🤦🏾‍♂️
@newnex_
@newnex_ 2 месяца назад
ByteBlox: "Let me talk about todays sponsor" Me: *exits fullscreen to leave video* ByteBlox "Being me" Me: *enters fullscreen again*
@officialshobi
@officialshobi 2 месяца назад
Subscribed. You do some really interesting games, and scripts. Since I'm into programming (and will be doing it as my future job and in my T-Level at college), you've inspired me to start programming in lua again. Thank you.
@JedotiOffical
@JedotiOffical 4 месяца назад
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)
@srgato7602
@srgato7602 2 месяца назад
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.
@slooshified_
@slooshified_ 4 месяца назад
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
@vknu
@vknu 4 месяца назад
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).
@1spark
@1spark 2 месяца назад
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
@waterless_sponge
@waterless_sponge 23 дня назад
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.
@KingShepskiy
@KingShepskiy 2 месяца назад
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 %
@Skrvmp
@Skrvmp 4 месяца назад
Being this early is criminial.. also ur vids r really good.. keep up the good work!!
@solidnywonsz
@solidnywonsz 4 месяца назад
not really
@Skrvmp
@Skrvmp 4 месяца назад
@@solidnywonsz oh
@Rimooooo
@Rimooooo Месяц назад
Quitting gambling is pretty hard too.
@f5tornado831
@f5tornado831 2 месяца назад
"Guys RNG's take effort I promise!!!!"
@QUENTEYY
@QUENTEYY Месяц назад
Oh yeah ByteBlox, thank you! You changed my life you opened my eyes! Y- you saved everything that was going wrong in my life!!!
@hugomazeo1479
@hugomazeo1479 4 месяца назад
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
@NauLeah
@NauLeah 2 месяца назад
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
@Shinssei
@Shinssei 3 месяца назад
this is late but for randomNum u shld do local randomNum = Random.new():NextNumber(0, 100) instead this selects numbers with decimals for randomNum as well and not just whole ones, so that you can add rarities with decimals like .5 if you're a psychopath please pin if u see this
@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.
@stephen5070
@stephen5070 2 месяца назад
How to make the rarity system better? The simple answer is including a crafting system to make the lesser valued items still useable and important. I don't even care about those thousands of reskinned collectable Pets from BIG Games. Like what is the point? Nostalgia is such a sneaky trap to keep players playing your game.
@DragonBallDetroit
@DragonBallDetroit 4 месяца назад
As a game developer there's several ways around this. Well I use unreal engine so it might be different for Roblox.
@rebel277
@rebel277 3 месяца назад
taking statistics made it easier honestly
@TacoEric
@TacoEric 4 месяца назад
all you need is knowing basic statistics and use random numbers
@SlimyJerryJelly
@SlimyJerryJelly 4 месяца назад
The only thing the pet sim kids are growing up to be are gambling addicts lol
@FaeTheMf
@FaeTheMf 4 месяца назад
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
@natsu1525
@natsu1525 3 месяца назад
i dont code at all, but you made this video interesting so i wanna support you
@Elqa12
@Elqa12 2 месяца назад
bro you are amazing! I have been trying to understand this for a while.
@wescom.vallen
@wescom.vallen 15 дней назад
I gave up coding in Unity. this actually looks a lot more easier than c#👍 *gets a severe mental breakdown* *destroys laptop*
@wescom.vallen
@wescom.vallen 15 дней назад
my mental stability isn't there anymore😭
@Haloyled
@Haloyled 4 месяца назад
Oh my glorious king ByteBlox are you going to do the thug shaker i have been waiting for so long
@tummy3950
@tummy3950 4 месяца назад
Please make a tutorial on how to level up your Scriptingan I have been stuck on third tomoe for a year now
@chocochoco5683
@chocochoco5683 2 месяца назад
nah i was forced to watch a 1 min ad, great vid tho!
@db_oi
@db_oi 4 месяца назад
Made a rarity system with pity and guarantee, and let me tell you man, it wasn't fun.
@Devil_edits_op
@Devil_edits_op 29 дней назад
can i use this: i am new so dont make fun please local luckforcommon = 60 local luckforrare = 39 local luck for legendary = 1 local pull = math.random if pull = 61 then print("rare") elseif pull > 99 or pull = 100 then print("ooga")
@polyneptic
@polyneptic 4 месяца назад
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.
@cliphin
@cliphin 2 месяца назад
5:14 that module function is like a struct or class i think so is it?.it seems similar thats why i asked
@wpsBoi
@wpsBoi 4 месяца назад
NoNoNo programming a rarity isn't hard but programming a good rarity is hard
@DavidMorales-s8d
@DavidMorales-s8d 4 месяца назад
if table order is not waranteed then dont return a value at that point. Instead, store the value and keep iterating
@MainGotDele
@MainGotDele 3 месяца назад
Imagine doing this and then figuring out there is Math.Random 💀💀💀
@mrpingouin5397
@mrpingouin5397 3 месяца назад
I am pretty sure that sols rng devs don't try to loop through 1 billion
@rocketpadgamer
@rocketpadgamer 4 месяца назад
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
@VitaminVitYT
@VitaminVitYT 4 месяца назад
all other devs after watching: 💀🤡 math.random(), random.new()
@jjophoven
@jjophoven 4 месяца назад
rarity is easy. just select a random index in an array and make lots of copies of common and one copy of legendary. the method in this video doesnt have the chances completely correct
@tomassamot8538
@tomassamot8538 4 месяца назад
Cant you just make a random number generator from 1 to 10 and then just make it so if it equals 10 then you get uncommon
@Ammiad
@Ammiad 4 месяца назад
​@@tomassamot8538you can but youll need a lot of if statements
@fitmotheyap
@fitmotheyap 4 месяца назад
​@@tomassamot8538 that's exactly what most do, just seperate items into rarities and roll rarity then roll a random item from that rarity list
@insertusernamehere8125
@insertusernamehere8125 4 месяца назад
Yep that's one easy way to do it and it works well, it gets kinda confusing if you have a lot of rarities though
@jjophoven
@jjophoven 4 месяца назад
@@tomassamot8538 that works if your common is 90% and uncommon 10%
@y.kal08
@y.kal08 Месяц назад
I can make a rarity system, but I don't know how to do it in roblox
@BROWNCHEES
@BROWNCHEES Месяц назад
Only if i would be willing to learn this instead of being lazy 😅😅 i got a realy trash mental when it comes to time consuming things.
@TypewritR
@TypewritR 4 месяца назад
rarity. random number gen: 0-1000 common 0-800 rare 801-950 epic 951-980 legendary 981-1000 easy.
@ГеоргийСамбуров-ф8ь
@ГеоргийСамбуров-ф8ь 4 месяца назад
sol's rng devs explaining why they wasted more than 5 minutes on their game:
@ffg-ws1eq
@ffg-ws1eq 3 месяца назад
tru
@darkiist
@darkiist 4 месяца назад
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
@Boosty-man
@Boosty-man 2 месяца назад
THX YOU VERY MUCH. ME AND MY FRIEND CAN FINALLY MAKE A GAME
@pudding6983
@pudding6983 2 месяца назад
Take notes Setro..
@chereyhotallygetufromfrida952
@chereyhotallygetufromfrida952 3 месяца назад
been considering for the course
@r4nd0mStuff
@r4nd0mStuff 2 месяца назад
Came expecting a detailed lecture about lua randomness and how to make your system truly random, got a beginner’s tutorial.
@dcannon121
@dcannon121 4 месяца назад
Idk I think coding rarity is pretty easy lol I can think of the code off the top of my head.
@Meanthes
@Meanthes Месяц назад
Bro rarity system is super easy, i have done it before in the past without watching a video abt it, what you have talking about
@aceifershadeison
@aceifershadeison Месяц назад
surely you can pick a random number between 1 and 100 and then do if then statements comparing them to the rarity numbers? this seems more complicated
@aceifershadeison
@aceifershadeison Месяц назад
while task.wait(2) do local A = math.random(1, 100) print(A) if A >= 99 then print("legendary") local part = Instance.new("Part") part.Parent = workspace part.Position = Vector3.new(0, 10, 0) part.Color = Color3.fromRGB(255, 255, 100) elseif A >= 94 then print("epic") local part = Instance.new("Part") part.Parent = workspace part.Position = Vector3.new(0, 10, 0) part.Color = Color3.fromRGB(255, 100, 128) elseif A >= 81 then print("rare") local part = Instance.new("Part") part.Parent = workspace part.Position = Vector3.new(0, 10, 0) part.Color = Color3.fromRGB(100, 100, 255) elseif A >=61 then print("uncommon") local part = Instance.new("Part") part.Parent = workspace part.Position = Vector3.new(0, 10, 0) part.Color = Color3.fromRGB(100, 255, 100) else print("common") local part = Instance.new("Part") part.Parent = workspace part.Position = Vector3.new(0, 10, 0) part.Color = Color3.fromRGB(100, 100, 100) end end
@aceifershadeison
@aceifershadeison Месяц назад
i whipped up a piece of script and it works! ive been learning lua scripting for roblox for a couple days and i wish i had a friend that knows alot about lua that i can ask questions. I want to make an rpg based on a cool idea i have but i have no clue how to script
@realBoba_
@realBoba_ Месяц назад
Me be like: local number = math.random(1,100) if number == 1 then print(YOU UNLOCKED THE 1 PERCENT OMG OMG OMG!!!!!!)
@petitcoke
@petitcoke 4 месяца назад
What software are you using to code this in?
@edmon974
@edmon974 4 месяца назад
This is Roblox studio, kinda self-explanatory
@pcoi94-2
@pcoi94-2 Месяц назад
I remembre, i maked a Weight Module in your discord server before i get banned for a stupide reason
@randomguywithasilkyfella
@randomguywithasilkyfella Месяц назад
proof that sols rng is underrated!!!!11!11!1!1!1!!!!1!
@alifnazan
@alifnazan 4 месяца назад
damn we can put table on table on table
@Wyrmver
@Wyrmver 4 месяца назад
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
@aniimey
@aniimey 8 дней назад
How to code to get epic every 10 pulls ? Oh and pity system 😅
@tazyjump5377
@tazyjump5377 3 месяца назад
Saw the title Here is the code: import random rarities = ["legendary", "rare", "uncommon","common"] chances= [5, 20, 30, 45] result = random.choices(rarities, chances) print(result) quit() Harder than I think? doubt so
@extracub1974
@extracub1974 4 месяца назад
You are a lost cause if you genuinely think this is remotely advanced.
@lunaticnomad0
@lunaticnomad0 4 месяца назад
Now I get why you think coding this is hard, and I agree.
@Benary-1
@Benary-1 4 месяца назад
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?
@Sabu_OZ
@Sabu_OZ 3 месяца назад
Nah this too confusing ☠️
@Dev-Captain
@Dev-Captain Месяц назад
Cant u just do: Local numb= Math.random(1,100) If numb 60 and numb < 85 then Rarity = uncommen Elseif numb >85 and numb
@HeyShattered
@HeyShattered 4 месяца назад
*This is my script, but it keeps giving me Common and I cant fix it* local Background = script.Parent.Background local Title = Background.Title local RarityText = Title.RarityText Background.Visible = false local ChanceList = { ["Common"] = {360000, Color3.fromRGB(38, 236, 94)}, ["Rare"] = {29979 , Color3.fromRGB(41, 129, 236)}, ["Epic"] = {1001, Color3.fromRGB(140, 30, 162)}, ["Legendary"] = {200, Color3.fromRGB(162, 153, 24)}, ["Nebulous"] = {120, Color3.fromRGB(96, 45, 200)}, ["Spectral"] = {100, Color3.fromRGB(170, 176, 200)}, ["SUS"] = {90, Color3.fromRGB(200, 114, 74)}, ["Mystic"] = {69, Color3.fromRGB(200, 36, 93)}, ["Universal"] = {50, Color3.fromRGB(125, 127, 200)}, ["Sapphire"] = {39, Color3.fromRGB(102, 0, 204)}, ["Galactic"] = {20, Color3.fromRGB(157, 160, 184)}, ["FluxFlare"] = {10, Color3.fromRGB(119, 204, 204)}, ["Electric"] = {5, Color3.fromRGB(54, 147, 181)}, ["Clockwork"] = {3, Color3.fromRGB(255, 204, 102)}, --{"Lucky", "Gamepass", Color3.fromRGB(0, 255, 21)}, --{"Owner", "THE OWNER 👑", Color3.fromRGB(255, 140, 0)} } local displayedChances = { ["Common"] = {3, Color3.fromRGB(38, 236, 94)}, ["Rare"] = {5, Color3.fromRGB(41, 129, 236)}, ["Epic"] = {10, Color3.fromRGB(140, 30, 162)}, ["Legendary"] = {20, Color3.fromRGB(162, 153, 24)}, ["Nebulous"] = {39, Color3.fromRGB(96, 45, 200)}, ["Spectral"] = {50, Color3.fromRGB(170, 176, 200)}, ["SUS"] = {69, Color3.fromRGB(200, 114, 74)}, ["Mystic"] = {90, Color3.fromRGB(200, 36, 93)}, ["Universal"] = {100, Color3.fromRGB(125, 127, 200)}, ["Sapphire"] = {120, Color3.fromRGB(102, 0, 204)}, ["Galactic"] = {200, Color3.fromRGB(157, 160, 184)}, ["FluxFlare"] = {1001, Color3.fromRGB(119, 204, 204)}, ["Electric"] = {29979, Color3.fromRGB(54, 147, 181)}, ["Clockwork"] = {360000, Color3.fromRGB(255, 204, 102)}, --{"Lucky", "Gamepass", Color3.fromRGB(0, 255, 21)}, --{"Owner", "THE OWNER 👑", Color3.fromRGB(255, 140, 0)} } local remoteEvent = game:GetService("ReplicatedStorage").DonationDone local spinsLeft = 12 local function spinRarity() local randomNum = math.random(1, 391686) -- Change 391686 to the SUM of all rarities (since the chosen rarity must be the appropriate % of the total rarities) local counter = 0 if spinsLeft > 0 then local selectedColor -- local selectedIndex local name for rarity, items in ChanceList do print(rarity, items[1]) counter += items[1] if randomNum
@santiago-et1cz
@santiago-et1cz 4 месяца назад
wouldn't "math.randomseed(os.time()) local random_number = math.random(1, 100) if random_number
@solderet_mp3
@solderet_mp3 4 месяца назад
oh god not the elseif chain
@ZaeNonQ
@ZaeNonQ 4 месяца назад
me when i use "pick random from 1 to 100" in scratch:
@eclair1616
@eclair1616 4 месяца назад
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 4 месяца назад
@@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 4 месяца назад
@@eclair1616 also he never even said anything about a programming language
@keppelin1527
@keppelin1527 4 месяца назад
J
@neonstix1035
@neonstix1035 4 месяца назад
@@eclair1616it is, it’s block coding. Even unreal engine has block coding.
@Lukas_Vx
@Lukas_Vx 4 месяца назад
1:26 yes, replicatedstorage
@FriedRatEater
@FriedRatEater 2 месяца назад
you mean thats not a good place to put it or smth?
@Ninja40294
@Ninja40294 2 месяца назад
​@@FriedRatEater He said ReplicatedStorage instead of ServerStorage (which is where he was putting the stuff)
@ilovemystove
@ilovemystove 2 месяца назад
@@FriedRatEaterserver storage is good because exploiters cant access it when theyre looking through the files
@FriedRatEater
@FriedRatEater 2 месяца назад
@@ilovemystove ah k, thats very helpful. Thanks
@Umbra_Vitae
@Umbra_Vitae 26 дней назад
@@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
@JakubYTchannel
@JakubYTchannel 4 месяца назад
me when math.random
@anotherdeadchannel
@anotherdeadchannel Месяц назад
Wait til I tell you that's pseudo random
@AstroKepler09
@AstroKepler09 Месяц назад
@@anotherdeadchannel Atmospheric pressure randomization moment
@buuild
@buuild 2 месяца назад
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.
@McDoubleMortem
@McDoubleMortem 2 месяца назад
This is exactly what I was trying to understand. Thanks random internet person who commented on a random youtube video about roblox
@buuild
@buuild 2 месяца назад
@@McDoubleMortem no problem
@zacvh_
@zacvh_ Месяц назад
I understand the code but I don’t understand what makes this harder than you’d think
@pinyw683
@pinyw683 7 дней назад
You explained it so well
@SuppressedMountain
@SuppressedMountain 4 месяца назад
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_9045
@_blaze_9045 2 месяца назад
Hey do you have discord? I’d like to talk abt something
@SuppressedMountain
@SuppressedMountain 2 месяца назад
@@_blaze_9045 ?
@j.5402
@j.5402 Месяц назад
What courses are you taking I am looking for some
@vclie
@vclie 25 дней назад
hey i also want to knwo what coursesare yuo learning
@audrete6071
@audrete6071 4 месяца назад
short answer: chatgpt, long answer: this video edit: thanks though, i understood the video
@HarrisssT
@HarrisssT Месяц назад
Ngl I worked this out on my own when I was learning to code, the title is a massive overstatement.
@alpha4194
@alpha4194 4 месяца назад
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 4 месяца назад
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 4 месяца назад
You eradicating the redundant roblox tutorials with the one
@Noob-ot8rf
@Noob-ot8rf 4 месяца назад
fr i put both together in a table inside the main table instead of making the index a string
@PeterMyler
@PeterMyler 4 месяца назад
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 4 месяца назад
@@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
@kilex3471
@kilex3471 4 месяца назад
Ah he used chatgpt for this
@byteblox100
@byteblox100 4 месяца назад
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.
@D4NONYT
@D4NONYT 4 месяца назад
1:26 "ReplicatedStorage"
@EpicPico0625
@EpicPico0625 4 месяца назад
ReplicatedStorage
@slavsit7600
@slavsit7600 4 месяца назад
ReplicatedStorage
@Quaplex4921
@Quaplex4921 4 месяца назад
ReplicatedStorage
@dinoavenger
@dinoavenger 4 месяца назад
ReplicatedStorage
@lIIllIIIIIlllIIIIlll
@lIIllIIIIIlllIIIIlll 4 месяца назад
ReplicatedStorage
@ZenkaiDragon400
@ZenkaiDragon400 4 месяца назад
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 🙏
@Hermit_Wish
@Hermit_Wish 4 месяца назад
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 4 месяца назад
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 4 месяца назад
@@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 4 месяца назад
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 4 месяца назад
local x = random(1,round(1/(rarity/100))) if x == 1 then print(“u got:”, x) end. Ez
@apekz3592
@apekz3592 4 месяца назад
Let’s say we have a chance of 0.01%, my formula would equate to random(1,10000)
@Platinum-Angel
@Platinum-Angel 4 месяца назад
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.
@lonras
@lonras 4 месяца назад
so first you decide which rarity you get and then you roll what item you get out of the pool of that rarity. Right?
@focuslp582
@focuslp582 2 месяца назад
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
@PasteurPlaysVideoGames
@PasteurPlaysVideoGames Месяц назад
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_Vitae
@Umbra_Vitae 26 дней назад
@@PasteurPlaysVideoGamesdivision
@KanYT
@KanYT 4 месяца назад
Meanwhile python
@thinedave
@thinedave 16 дней назад
Why the counter variable? I was with you fully until you added that, which just seems unnecessarily complex and harder to implement.
@CarbonMonoxide911
@CarbonMonoxide911 4 месяца назад
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 4 месяца назад
Yeah I was think the same thing
@pickleilyc
@pickleilyc 4 месяца назад
yea thats basically weightage, not sure why people are so confused on how to do this
@Dimayuplay
@Dimayuplay 4 месяца назад
Yaay i luv being weak and insignificant!.. Such a bottom!!.. //>w
@Garbaige
@Garbaige 4 месяца назад
4 mins this time lol still good luck tho i dont even have notifications on i just hoped on my home page lol
@FrogsAreGods
@FrogsAreGods 4 месяца назад
roblox devs are on crack if they think rarity is hard wait till yall learn about quaternians
@twurtle6416
@twurtle6416 Месяц назад
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
@topsnag
@topsnag 3 месяца назад
Don’t know anything about scripting but this video was entertaining
@Simo-dm1zd
@Simo-dm1zd 4 месяца назад
scripting a rarity system is easy tbh, the real difficulty is scripting a LUCK system inside the rarity one
@solderet_mp3
@solderet_mp3 4 месяца назад
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.
@batatafrita5455
@batatafrita5455 4 месяца назад
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 &&
@thedoggod7737
@thedoggod7737 2 месяца назад
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
@ing32
@ing32 4 месяца назад
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 4 месяца назад
It’s 1% because every other rarity is retrieved the same way, so the ratio remains the same
Далее
Why Don't More Games Have "Team-Based" Abilities?
7:44
Exploits Are EASY to Fix, People Are Just Lazy
11:42
Просмотров 278 тыс.
Главное рыба есть, а воды нет..
00:54
I Made the Hardest Game Ever
10:15
Просмотров 12 млн
The Worst Website on Discord...
12:06
Просмотров 483 тыс.
hackers just won't stop stealing KJ.
8:02
Просмотров 662 тыс.
Classic Roblox RPG | Devlog #5 - BIG UPDATE!
7:18
Просмотров 10 тыс.
The Only Thing You Need To Learn How To Script
4:36
Просмотров 196 тыс.
I Made a Roblox Obby That's Secretly a Horror Game
4:48
I made a viral roblox game to prove it's not luck…
8:12
Bedrock. Why?!
22:37
Просмотров 427 тыс.
Gear - Roblox's Biggest Scam
8:33
Просмотров 469 тыс.
I Made a Roblox Game in 100 Hours...
11:26
Просмотров 335 тыс.