Color Correction Enabled On Death [Now Works]

I was working on a project of mine and stumbled into a annoying situation, my script wasn’t working. I’ve tried putting this in both ServerScriptService and StarterPlayerScripts.

What did I do wrong and how could I fix this?

local humanoid = script.Parent:WaitForChild("Humanoid")

game.ColorCorrection.Enabled = false

humanoid.Died:Connect(function()
	game.ColorCorrection.Enabled = true
	
	wait(game.Players.RespawnTime - 0.1)
	game.Lighting.ColorCorrection.Enabled = false
end)

If you need any further details please let me know

you put game.ColorCorrection not game.Lighting.ColorCorrection. Add the lighting and you’ll be good to go.

1 Like

How did you somehow put a ColorCorrection into the game itself? You just need to add Lighting after game. and you should be fine, or better, reference the Services directly

Code below is recommended to be in a localscript inside of StarterCharacterScripts

local Lighting = game:GetService("Lighting")
local Players = game:GetService("Players")

local humanoid = script.Parent:WaitForChild("Humanoid")
local colorCorrection = Lighting.ColorCorrection

colorCorrection.Enabled = false

humanoid.Died:Connect(function()
	colorCorrection.Enabled = true
	
	wait(Players.RespawnTime - 0.1)
	colorCorrection.Enabled = false
end)
1 Like

Ok wut, if you’re defining the Humanoid you should parent it inside StarterCharacterScripts instead

Also this script will depend if it’s Local or Server, if you change the effects on a Server Script, it’ll be replicated to everyone

And this should be game.Lighting, but I’m assuming that was a typo mistake

Try this as a LocalScript parented inside StarterCharacterScripts:

local Humanoid = script.Parent:WaitForChild("Humanoid")

game.Lighting.ColorCorrection.Enabled = false

Humanoid.Died:Connect(function()
    game.Lighting.ColorCorrection.Enabled = true

    wait(game.Players.RespawnTime - 0.1)
    game.Lighting.ColorCorrection.Enabled = false
end)
1 Like

@BabyNinjaTime @EmbatTheHybrid @JackscarIitt

Alright I got it working, like I have stated before scripting is not my strongpoint. Thank you for your help :slightly_smiling_face:

2 Likes