Hello, I've been trying to create a window that can switch between transparency's but can't figure out the switching between the transparency's part. Here the code I've been using;
local window = script.Parent.Parent script.Parent.MouseClick:Connect(function() if window.Transparency = 0.4 window.Transparency = 0 print("Transparency Set to 0!") else window.Transparency = 0.4 print("Transparency Set to 0.4!") end end)
Thanks for any help!
I'm not 100% why your script isn't working, but I noticed you use the transparency property of the window to check if it is in a certain state, it's safer to use a different variable for the state of the part to prevent your script from breaking, like this:
local window = script.Parent.Parent local ClickDetector = script.Parent local state = 1 ClickDetector.MouseClick:Connect(function() if state == 1 then state = 2 window.Transparency = 0.4 elseif state == 2 then state = 1 window.Transparency = 0 end end)
Hope this helps!