I am attempting to make a OnClick script that when you click on the brick it goes to transparency=1 or transparency=0
Here, put this script inside the brick:
script.Parent.ClickDetector.MouseClick:connect(function() if script.Parent.Transparency == 0 then script.Parent.Transparency = 1 elseif script.Parent.Transparency == 1 then script.Parent.Transparency = 0 end end)
local brick = script.Parent brick.ClickDetector.MouseClick:connect(function() brick.Transparency = brick.Transparency == 0 and 1 or 0 end)
-- PUT THIS SCRIPT IN THE BRICK brick = script.Parent function TurnVisible() if brick.Transparency == 1 then brick.Transparency = 0 -- Add anything else you want, like changing the name, color etc. elseif brick.Transparency == 0 then brick.Transparency = 1 -- Add anything else you want, like changing the name, color etc. end end brick.MouseButton1Down:connect(TurnVisible) --if Line 14 doesn't work all the time, do this and remove the --[[ and ]] --[[ while true do brick.MouseButton1Down:connect(TurnVisible) wait() end ]]
script.Parent.ClickDetector.MouseClick:connect(function() if Part.Transperancy == 0 do wait() script.Parent.Transperancy = 1 wait(1) script.Parent.Transperancy = 0 end) -- Add a ClickDetector in the brick and this script.