Color Correction wont change back after player dies

When a player dies their saturation is supposed to go down all the way to -1, this works but when they respawn it should be reverted back to 0 but it doesn’t.

local Player = game.Players.LocalPlayer
Player.Character:WaitForChild("Humanoid").Died:Connect(function(player)
local Lighting = game:GetService("Lighting")

wait(3) -- time it takes to respawn
Lighting.Death.Saturation = 0
print("Hi")
end)

It prints “hi” in the command bar but it wont change the saturation. Any solutions to this?

give this one a go and tell me if it works

local Player = game.Players.LocalPlayer
local Lighting = game:GetService("Lighting")

-- Function to reset saturation
local function resetSaturation()
    Lighting.Death.Saturation = 0
    print("Hi")
end

-- Connect to the Died event
Player.Character:WaitForChild("Humanoid").Died:Connect(function()
    wait(3) -- time it takes to respawn
    resetSaturation()
end)

-- Connect to the CharacterAdded event to reset saturation upon respawn
Player.CharacterAdded:Connect(function(character)
    character:WaitForChild("Humanoid").Died:Connect(function()
        wait(3) -- time it takes to respawn
        resetSaturation()
    end)
end)

The issue may be lies in how the script is handling the Lighting’s Death.Saturation property. Since the code prints “Hi”, it means the function is being called, but the Lighting.Death.Saturation is not being changed as expected

I tried your code and unfortunately the saturation still wont revert

local Player = game.Players.LocalPlayer
local Lighting = game:GetService("Lighting")

-- Store the default saturation value
local defaultSaturation = Lighting.Death.Saturation

-- Function to reset saturation
local function resetSaturation()
    Lighting.Death.Saturation = defaultSaturation
    print("Saturation reset to", defaultSaturation)
end

-- Function to handle player death
local function onPlayerDeath()
    wait(3) -- time it takes to respawn
    resetSaturation()
end

-- Connect to the Died event
Player.Character:WaitForChild("Humanoid").Died:Connect(onPlayerDeath)

-- Connect to the CharacterAdded event to reset saturation upon respawn
Player.CharacterAdded:Connect(function(character)
    character:WaitForChild("Humanoid").Died:Connect(onPlayerDeath)
    resetSaturation() -- Reset saturation when character respawns
end)

-- Initial reset in case the script runs after the character is loaded
if Player.Character then
    resetSaturation()
end

i think i did a mistake there try this?

The code still does not work, when the script printed what the saturation was reset to after the players death, it was a long negative number so I decided to change the default saturation to be 0 and even though it printed Saturation reset to 0 it still didn’t work.

it works i can assure you that put the local script to
starterplayerscripts

local Player = game.Players.LocalPlayer
local Lighting = game:GetService("Lighting")

-- Function to handle player death
local function onPlayerDeath()
    Lighting.Death.Saturation = -1
    print("Saturation set to -1 on death")
end

-- Function to reset saturation
local function resetSaturation()
    Lighting.Death.Saturation = 0
    print("Saturation reset to 0 on respawn")
end

-- Connect to the Died event
Player.CharacterAdded:Connect(function(character)
    local humanoid = character:WaitForChild("Humanoid")
    
    humanoid.Died:Connect(onPlayerDeath)
    
    -- Reset saturation when the character respawns
    resetSaturation()
end)

-- Ensure saturation is reset if the script runs after the character is already loaded
if Player.Character then
    resetSaturation()
end

you can change the value if you want more saturated
but it works put the color correction in lighting name it death and you are ready to go but i tested it it works

Your script works I just found out that the script wasn’t working due to another script I dont know if that means your previous scripts didn’t work but thanks a lot for the help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.