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)