✓ Accepted answer
#Solution to your Issue
math.random will return any number between a,b. Therefore it can return decimal numbers too. you can use math.ceil to get either expected number. (math.ceil rounds upwards.)
#Randomly selecting a Part
This is very simple. You can place all Bricks into a Table, and randomly selecting the Element. First and foremost you’ll reference the Parts and set them up. Like so:
local Parts = {workspace.Part1,workspace.Part2,workspace.Part3}
This is Table, if you didn’t know already. It allows you to set two or more values in a single variable.
Then, we will use said math.random to select a random Element in Parts. As Tables use numerical indexing to reference each Element.
math.randomseed(tick())
local RandomPart = Parts[math.random(1,#Parts)]
As you know, math.random returns any number between a,b. Square brackets are used to index an Element. For example Parts[2] would be Part2. We can use math.random to give us a random index in Parts. For us to properly do so, you’ll have to give it 1, as the lowest index, and #Parts, which will return the total length of Parts, which will be the highest; last.
After we’ve got our randomly selected Part: RandomPart, you can run it through whichever transparency function you’ve written.
Hope this is what you’re looking for! If so, don’t forget to accept!
3 comments
I changed random to ran and the script still doesn't work.
I personally reccomend learning coding before making a game. Not looking up tutorials on specific things. I've made that mistake.
HOWEVER that doesn't mean you can't use scripting helpers as help.