Hello, so in my game, I wanted to make pressing the key "N" activate a ColourCorrection script ( Night vision looking ) Thankfully, my script worked almost as expected. The only problem is you load into the game with the effect already activated. Then pressing N deactivates it, instead of loading in with it deactivated on default. Here is the script:

local input = game:GetService("UserInputService")
local toggle = false
local cc = script:WaitForChild("ColorCorrection")
input.InputBegan:connect(function(inp, proc)
	cc.Parent = workspace.CurrentCamera
	if inp.KeyCode == Enum.KeyCode.N then
			toggle = not toggle
				if toggle == false then
					cc.Enabled = false
				else
					toggle = true
					cc.Enabled = true
				end
	end
end)

I attempted switching true and false on some variables, with no avail. This is a StarterCharcacterScript. Any fixes?

5 comments

0

Have you tried setting toggle to true?

0

oh wait you did. sorry i will try and find a fix

0

Why are you setting the color correction parent to the camera every time it's activated? Can't you just do it once at the beginning?

0

Kepiblop // okay, tell me if you come up with something.

0

thecelestialcube // I guess so, but do you have any ideas on how to fix my problem?