so i have this nightvision script and i want to make the de activate sound to play when the player clicks on the button again
my script:
script.Parent.ClickBox.MouseButton1Click:Connect(function()
script.Parent.Activate:Play()
game.Lighting.NightVisionColor.Enabled = not game.Lighting.NightVisionColor.Enabled
end)
so i made it thanks and it works but i made a diffrent one with key binds and it dosent seem to work
local UserInputService = game:GetService("UserInputService")
local actoov = false
local function onInputBegan(input, gameProcessed)
if input.UserInputType == Enum.KeyCode.Y then
game.Lighting.NightVisionColor.Enabled = not game.Lighting.NightVisionColor.Enabled
if actoov == false then
script.Parent.Activate:Play()
actoov = true
elseif actoov == true then
script.Parent.Deactivate:Play()
actoov = false
end
end
UserInputService.InputBegan:Connect(onInputBegan)
end
