I tried to make my part transparency Randomly For My Game..
My Script is:
Game.Workspace.Part.Transparency = Transparency.Random()
And ITs not Working :(
game.workspace.Part.Transparency = math.random(1,10)/10
This will create a random number between one and ten, and then divide that value so that you get either a decimal in the tenth's place or one.
What is happening is, there is no globally recognized function for Transparency. BrickColor is something unique because it essentially is a function when setting its value (BrickColor.new()
). In fact transparency is a float value, meaning it will only take a number between 0 and 1 and display it properly.
What you can do is use math.random()
. If there are no arguments of math.random()
then Lua will pick any decimal between 0 and 1 every time.
game.Workspace.Part.Transparency = math.random()
Got It!
while true do wait(1) Game.Workspace.Part.Transparency = math.Random(1,10)/10 end