Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make this Colour Correction script disabled upon entering the game?

Asked by 3 years ago

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?

0
Have you tried setting toggle to true? kepiblop 124 — 3y
0
oh wait you did. sorry i will try and find a fix kepiblop 124 — 3y
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? thecelestialcube 123 — 3y
0
Kepiblop // okay, tell me if you come up with something. 700000002 0 — 3y
0
thecelestialcube // I guess so, but do you have any ideas on how to fix my problem? 700000002 0 — 3y

Answer this question