ColorCorrection is not a vlid member of Lightning "Lightning"

Hello! Does anyone know about the error [ColorCorrection is not a valid member of Lightning “Lightning”]

My code is

local function Part3()
	
	local Rain = Objectives.RainObjective.Rain:Clone()
	local Lightning = Objectives.RainObjective.Lightning:Clone()
	local Fire = Objectives.RainObjective.Fire:Clone()
	
	wait(4)
	TransitionEvent:FireAllClients()
	wait(2)
	
	Rain.Parent = game.Workspace
	game.Lighting.TimeOfDay = 1
	wait(3)
	
	DialogueEvent:FireAllClients(NpcImage, NpcName, "It's raining! We should go back to the cabin!")
	wait(4)
	NpcModel.Humanoid:MoveTo(WalkToPoints.CabinPoint.Position)
	NpcModel.Humanoid.MoveToFinished:Wait()
	wait(4)
	
	Lightning.Parent = game.Workspace
	
	game.Lighting.ColorCorrection.Brightness = 0.5
	game.Lighting.ColorCorrection.Contrast = 0.5
	wait(3)
	game.Lighting.ColorCorrection.Brightness = 0.08
	game.Lighting.ColorCorrection.Contrast = 0.1
	
	Lightning:Destroy()
	Fire.Parent = game.Workspace

I searched on the developer forums and couldn’t find anything about it.

That means that for whatever reason “ColorCorrection” is not a child of your lightning. So when your code is looking for it it’s getting confused because it can’t find it.

I’ve been trying to solve it for an hour now, and I can’t seem to find the issue in the code.

image

It appears even if I delete it.

I don’t particularly see an issue with what you’ve written. So it’s probably your hierarchy that’s wrong. Or somewhere else in the code.

The I will note that when you clone the lightning you should parent it. Right now it’s parent is nil. never mind, totally missed the line that parents it. And if the game.Workspace.Lightning is just the same lightning you cloned then you should just use the lightning variable instead of its path.

Okay, well I’m new to programming. Could you maybe specify. Should I do something in the code or?

Actually wow I’m overlooking the obvious today. You’re trying to access color correction from lightning somewhere. Probably a miss type of lighting.

local function Part3()
	local Rain = Objectives.RainObjective.Rain:Clone()
	local Lightning = Objectives.RainObjective.Lightning:Clone()
	local Fire = Objectives.RainObjective.Fire:Clone()
	
	wait(4)
	TransitionEvent:FireAllClients()
	wait(2)
	
	Rain.Parent = game.Workspace
	game.Lighting.TimeOfDay = 1
	wait(3)
	
	DialogueEvent:FireAllClients(NpcImage, NpcName, "It's raining! We should go back to the cabin!")
	wait(4)
	NpcModel.Humanoid:MoveTo(WalkToPoints.CabinPoint.Position)
	NpcModel.Humanoid.MoveToFinished:Wait()
	wait(4)
	
	Lightning.Parent = game.Workspace
	
	workspace.RainObjective.Lighting.ColorCorrection.Brightness = 0.5
	workspace.RainObjective.Lighting.ColorCorrection.Contrast = 0.5
	wait(3)
	workspace.RainObjective.Lighting.ColorCorrection.Brightness = 0.08
	workspace.RainObjective.Lighting.ColorCorrection.Contrast = 0.1
	
	Lightning:Destroy()
	Fire.Parent = game.Workspace

You can try that

Basically hit control F to pull up the search bar, and search for a lightning.ColorCorrection. That’s probably a typo and you mean Lighting.ColorCorrection. I don’t see it anywhere in your current code though.

local function Part3()


	wait(4)
	TransitionEvent:FireAllClients()
	wait(2)
	
	local RainEffect = Objectives.RainObjective.Rain:Clone()
	RainEffect.Parent = game.Workspace
	game.Lighting.TimeOfDay = 1
	wait(3)

	DialogueEvent:FireAllClients(NpcImage, NpcName, "It's raining! We should go back to the cabin!")
	wait(4)
	NpcModel.Humanoid:MoveTo(WalkToPoints.CabinPoint.Position)
	NpcModel.Humanoid.MoveToFinished:Wait()
	wait(4)
	
	local LightningEffect = Objectives.RainObjective.Lightning:Clone()
	LightningEffect.Parent = game.Workspace

	game.Lighting.ColorCorrection.Brightness = 0.5
	game.Lighting.ColorCorrection.Contrast = 0.5
	wait(3)
	game.Lighting.ColorCorrection.Brightness = 0.08
	game.Lighting.ColorCorrection.Contrast = 0.1

	LightningEffect:Destroy()
	local FireEffect = Objectives.RainObjective.Fire:Clone()
	FireEffect.Parent = game.Workspace

image

This happens!

Your original code is fine, the most likely error is a typo somewhere else.

You were looking for color correction as a child of lightning, when you need to be looking for color correction as a child of lighting

Sorry, I was going based off this screenshot:
image

Had no idea what that was the descendant of, probably lighting now that I think about it.

So you’d change workspace to “game.Lighting,” it should be:

local function Part3()
	local Rain = Objectives.RainObjective.Rain:Clone()
	local Lightning = Objectives.RainObjective.Lightning:Clone()
	local Fire = Objectives.RainObjective.Fire:Clone()
	
	wait(4)
	TransitionEvent:FireAllClients()
	wait(2)
	
	Rain.Parent = game.Workspace
	game.Lighting.TimeOfDay = 1
	wait(3)
	
	DialogueEvent:FireAllClients(NpcImage, NpcName, "It's raining! We should go back to the cabin!")
	wait(4)
	NpcModel.Humanoid:MoveTo(WalkToPoints.CabinPoint.Position)
	NpcModel.Humanoid.MoveToFinished:Wait()
	wait(4)
	
	Lightning.Parent = game.Workspace
	
	game.Lighting.RainObjective.Lighting.ColorCorrection.Brightness = 0.5
	game.Lighting.RainObjective.Lighting.ColorCorrection.Contrast = 0.5
	wait(3)
	game.Lighting.RainObjective.Lighting.ColorCorrection.Brightness = 0.08
	game.Lighting.RainObjective.Lighting.ColorCorrection.Contrast = 0.1
	
	Lightning:Destroy()
	Fire.Parent = game.Workspace

image

I found the solution.

local function Part3()
	local Rain = Objectives.RainObjective.Rain:Clone()
	local Lightning = Objectives.RainObjective.Lightning:Clone()
	local Fire = Objectives.RainObjective.Fire:Clone()

	wait(4)
	TransitionEvent:FireAllClients()
	wait(2)

	Rain.Parent = game.Workspace
	game.Lighting.TimeOfDay = 1
	wait(3)

	DialogueEvent:FireAllClients(NpcImage, NpcName, "It's raining! We should go back to the cabin!")
	wait(4)
	NpcModel.Humanoid:MoveTo(WalkToPoints.CabinPoint.Position)
	NpcModel.Humanoid.MoveToFinished:Wait()
	wait(4)

	Lightning.Parent = game.Workspace

	game.ReplicatedStorage.Objectives.RainObjective.Lightning.ColorCorrection.Brightness = 0.5
	game.ReplicatedStorage.Objectives.RainObjective.Lightning.ColorCorrection.Contrast = 0.5
	wait(3)
	game.ReplicatedStorage.Objectives.RainObjective.Lightning.ColorCorrection.Brightness = 0.08
	game.ReplicatedStorage.Objectives.RainObjective.Lightning.ColorCorrection.Contrast = 0.1

	Lightning:Destroy()
	Fire.Parent = game.Workspace
1 Like