Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would you make a block that transparent go opaque and back transparent again?

Asked by
s_21 74
7 years ago
Edited 7 years ago

So, I have a block with the transparency of 0.5, But I would like it when you click the block the transparency goes to 1.0 then if you click the block again it will return back to 0.5

Thanks for y'all's help!

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

First put a ClickDetector and BoolValue into your part, and insert this script.

01local clickdetector = script.Parent:WaitForChild("ClickDetector")
02 
03clickdetector.MouseClick:Connect(function(FirstClick)
04    if script.Parent.Value.Value == false then
05        script.Parent.Transparency = 1
06        script.Parent.Value.Value = true
07    else
08    if  script.Parent.Value.Value == true then
09        script.Parent.Transparency = 0.5
10        script.Parent.Value.Value = false
11        end
12    end
13end)

Accept my answer if this helps!

Ad

Answer this question