I tried to make my part transparency Randomly For My Game..
My Script is:
Game.Workspace.Part.Transparency = Transparency.Random()
And ITs not Working :(
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.
##Problem
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.
##Solution
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.
##Final Script
game.Workspace.Part.Transparency = math.random()
######Hopefully this answered your question. If so, hit the accept answer button. If you have any questions feel free to comment below.
Got It!
while true do
wait(1)
Game.Workspace.Part.Transparency = math.Random(1,10)/10
end
This discussion is preserved as it was. New answers, comments, and votes are closed.