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
6 years ago
Edited 6 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 6 years ago
Edited 6 years ago

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

local clickdetector = script.Parent:WaitForChild("ClickDetector")

clickdetector.MouseClick:Connect(function(FirstClick)
    if script.Parent.Value.Value == false then
        script.Parent.Transparency = 1
        script.Parent.Value.Value = true
    else
    if  script.Parent.Value.Value == true then
        script.Parent.Transparency = 0.5
        script.Parent.Value.Value = false
        end
    end
end)

Accept my answer if this helps!

Ad

Answer this question