✓ Accepted answer
Hello!
I see your problem here. In the second script, you aren't setting the m and n values of the math.random. These are the values that set the minimum and maximum of the random numbers. For example, if you wanted to be given a random number between 1 to 100, you would type something like this: print(math.random(1 --The minimum, 100 --The maximum). Or ,if you wish your minimum number to be one, you can just totally remove the minimum number, and it would look something like this: print(math.random(100 --The maximum). It would still work flawlessly.
In your case, the numbers you should probably use are 0 and 1, since with Color3 the values are from 0 to 1. You also have to use the minimum number (0), because it is not 1. However, if you wish to have a wider option colours; you should probably use Color3.fromRGB. Instead of the colour values arranging from 0 to 1, your options would be from 0 to 255. To use this option, replace Color3.new from the second script to Color3.fromRGB. Obviously, here, you should make the minimum number 0 and the maximum number 255.
I hope this helps!
THANKS FOR READING!