I've recently made a death effect, it a local script located inside StarterPlayerScripts and applies a ColorCorrectionEffect and Blur to the screen upon death. It works perfectly fine when for the first time I die, but after I die once it simply doesn't activate, any idea why?
Code:
local CCE = Instance.new("ColorCorrectionEffect", game.Lighting)
CCE.Saturation = 0
CCE.Brightness = 0
CCE.Contrast = 0
local BE = Instance.new("BlurEffect", game.Lighting)
BE.Size = 0
script.Parent.Parent.CharacterAdded:Wait()
script.Parent.Parent.Character:WaitForChild("Humanoid").Died:Connect(function()
for i = 1, 150 do
wait(0.0125)
BE.Size = BE.Size + 0.45
CCE.Saturation = CCE.Saturation - 0.0125
CCE.Brightness = CCE.Brightness - 0.00625
CCE.Contrast = CCE.Contrast - 0.00625
end
wait(0.5)
for i = 1, 75 do
wait(0.0125)
BE.Size = BE.Size - 0.9
CCE.Saturation = CCE.Saturation + 0.025
CCE.Brightness = CCE.Brightness + 0.0125
CCE.Contrast = CCE.Contrast + 0.0125
end
CCE.Saturation = 0
CCE.Brightness = 0
CCE.Contrast = 0
BE.Size = 0
end)

2 comments
What is wrong with your code is on line 07. When a character is added it fires a wait. You need to add :Connect because all you are telling it to do is wait. There is a disconnect between when the player is added and when the player dies. I will post a simpler code so you get what I mean.