How would I make a certain % chance something shows on a GUI?

Not sure if I put it in Scripting or GUI Support so just tell me if it is wrong please!

I am trying to add a feature on my GUI where at random times upon loading it will display text, this is meant to be an “easter egg” type thing where theres a 3% chance of it happening or if not 1 in 300

In other words, how do I make it so theres a 3% chance text is displayed on my GUI?

Thank you!

you would need to get a random precent so you would do “local value = math.random(1,100)”
then you got your precent then you gotta get if the value == 3 so “if value == 3 then” do the rest


You could have a table with the item and their associated rarity (0 - 1). Then you could display it on the text label by multiplying it by 100 and concatenating a “%” sign at the end.

sorry for my runon sentences


Actually, this is not a good idea if you have lots of possible chances. It’s better to use a Weighted system.


youre correct but i wanted to keep it simple rather than complicated