I wanted to make a script so alot of different colored bricks come out of the ground but i dont know how to do math.random for brick colors i thought it was like this:
p.BrickColor = BrickColor.new(math.random(1,5), math.random(1,5), math.random(1,5))
Is that correct or no?
Use this
p.BrickColor = BrickColor.random()
You can use BrickColor.Random(), but note that it chooses from the available BrickColors; on average, it returns an RGB of (0.59, 0.56, 0.53), whereas a truly random colour generator should return an average of about (0.5, 0.5, 0.5). In other words, you'll be more likely to get a colour with a lot of red in it than you might expect (though it's unlikely you'd notice in practice).
If you want a more even distribution, use:
p.BrickColor = BrickColor.new(math.random(), math.random(), math.random())
The constructor is BrickColor.new(r,g,b), where r,g,b are between 0 and 1. math.random() without parameters gives such a number (though math.random() will never return precisely 1; it might return 0.999999 instead).
Using this method isn't perfect either, since the available BrickColors are not evenly distributed, but it's much closer, giving an average RGB of (0.50, 0.49, 0.50).
See http://wiki.roblox.com/index.php?title=API:BrickColor for more on BrickColor, including other ways of creating one.