Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't the ColorCorrection disable after someone dies/resets?

I'm trying to make the screen a dark red when their health is low or when they die. I have this so far;

player.CameraMode=Enum.CameraMode.LockFirstPerson
local blur=Instance.new("BlurEffect")
local cc=Instance.new("ColorCorrectionEffect")

uis.MouseIconEnabled=false

mouse.Move:connect(function()
	blur.Size=7
	blur.Parent=workspace.CurrentCamera
end)
mouse.Idle:connect(function()
	wait(2)
	blur.Size=0
end)

spawn(function() while wait() do
		if humanoid.Health<15 then
			cc.Enabled=true
			cc.Parent=workspace.CurrentCamera
			cc.TintColor=Color3.new(100/255,0,0)
		elseif humanoid.Health<20 then
			cc.Enabled=true
			cc.Parent=workspace.CurrentCamera
			cc.TintColor=Color3.new(95/255,0,0)
		elseif humanoid.Health<25 then
			cc.Enabled=true
			cc.Parent=workspace.CurrentCamera
			cc.TintColor=Color3.new(90/255,0,0)
		elseif humanoid.Health>25 then
			cc.Enabled=false
		end
	end
end)

1 answer

✓ Accepted answer

Try doing this instead of using humanoid.Health > 25

humanoid.HealthChanged:connect (function(health)
If health < 25 then

  cc.Parent=workspace.CurrentCamera
            cc.TintColor=Color3.new(90/255,0,0)
elseif health < 20 then
 cc.Enabled=true
            cc.Parent=workspace.CurrentCamera
            cc.TintColor=Color3.new(95/255,0,0)
elseif health < 15 then
  cc.Enabled=true
            cc.Parent=workspace.CurrentCamera
            cc.TintColor=Color3.new(100/255,0,0)
end
end)

player.CharacterAdded:connect(function(c)

  cc.Enabled=false
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.