NightVision doesnt turn off when input is pressed again

I made a nightvision script but i have an issue where if you were to press E again while nightvision is on, it wont turn off

Heres the script

local uis = game:GetService("UserInputService")


local char = script.Parent


local equipRE = game.ReplicatedStorage:WaitForChild("NVGsToggled")


local defaultAmbient = game.Lighting.OutdoorAmbient



uis.InputBegan:Connect(function(input, processed)


	if processed then return end


	if input.KeyCode == Enum.KeyCode.E then
		
		
	if char:FindFirstChild("NVGs") then 
		
		
			equipRE:FireServer(true)


			game.Lighting.OutdoorAmbient = Color3.fromRGB(255, 255, 255)
			game.Lighting.NVG.Enabled = true

		else
			
			equipRE:FireServer(false)


			game.Lighting.OutdoorAmbient = defaultAmbient
			game.Lighting.NVG.Enabled = false
		end
	end
end)

Use a toggle variable.

local uis = game:GetService("UserInputService")


local char = script.Parent
local equipRE = game.ReplicatedStorage:WaitForChild("NVGsToggled")
local defaultAmbient = game.Lighting.OutdoorAmbient
local toggle = false

uis.InputBegan:Connect(function(input, processed)
	if processed then return end
	if input.KeyCode == Enum.KeyCode.E then
		toggle = not toggle
		if toggle then 
			equipRE:FireServer(true)
			game.Lighting.OutdoorAmbient = Color3.fromRGB(255, 255, 255)
			game.Lighting.NVG.Enabled = true
		else
			equipRE:FireServer(false)
			game.Lighting.OutdoorAmbient = defaultAmbient
			game.Lighting.NVG.Enabled = false
		end
	end
end)