Hello, I'm fairly new to scripting. I was testing out things and couldn't figure out how to make something happen while left click is held down. I am trying to make x-ray goggles. I want it to be green and halfway transparent while the left click is held down and normal when not. This is what I have so far. As you can see, right now if you click once and changes for 20 secs and reverts back to normal.
local Door = game.Workspace.Doory
local Tool = script.Parent
Tool.Equipped:Connect(function(Mouse)
Mouse.Button1Down:Connect(function()
Door.Transparency = 0.5
Door.BrickColor = BrickColor.new("Camo")
wait(20)
Door.Transparency = 0
Door.BrickColor = BrickColor.new("Dark stone grey")
end)
end)
Any help would be appreciated.

4 comments
Did what the old script did but I wan't it to go transparent while the button is held down and switch back when it is not.
what do you specifycally want?
Sorry i'm late but I just saw this. I'm trying to have the brick color and transparency change ONLY when the button is being held down. Then when I let go of the right click the part gets back it's original properties.
did you manage to do that?