I want to have it so when the player clicks on the part (a wood floor) , every single part will fade to a transparency of 1 at a random time. For example, you click on a certain part and then the wood floor fades in. Please help.
01 | modelName = game.Workspace.YOURMODELNAMEHERE:GetChildren() -- make sure that is the path to YOUR model |
02 | transparencyValue = . 1 --transparency variable |
03 |
04 |
05 | while game.Workspace.YOURMODELNAME.PartINYOURMODEL.Transparency < = 1 do -- while loop that continues until one of the parts transparency is equal to 1 again make sure you change the path to work with your model |
06 | for _, child in ipairs (modelName) do -- loops through all the parts inside the model |
07 | child.Transparency = transparencyValue -- sets the part equal to the transparencyValue |
08 | end |
09 | transparencyValue = transparencyValue + 0.1 -- Rate at which the transparency increases change this to whatever you want keeping in mind 1 is transparent 0 is solid |
10 | wait(. 5 ) -- waits before starting over again change the time to whatever you want |
11 | end |
If you need more explanation feel free to message me
Version without comments:
1 | modelName = game.Workspace.LOL:GetChildren() |
2 | transparencyValue = . 1 |
3 | while game.Workspace.LOL.Part.Transparency < = 1 do |
4 | for _, child in ipairs (modelName) do |
5 | child.Transparency = transparencyValue |
6 | end |
7 | transparencyValue = transparencyValue + 0.1 |
8 | wait(. 5 ) |
9 | end |