I have a localscript in startergui that basically checks to see if the players health is at a certain point, then change the lighting based off their situation. However, it doesnt go back to normal when the character is added back in?
local player = game.Players.LocalPlayer
local lighting = game:GetService("Lighting")
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:FindFirstChild("Humanoid")
local heartbeat = script.Heartbeat
local death = script.Death
player.CharacterAdded:Connect(function()
lighting.ColorCorrection.Contrast = 0
lighting.ColorCorrection.Saturation = 0
lighting.ColorCorrection.Brightness = 0
heartbeat:Stop()
end)
hum.HealthChanged:Connect(function()
if hum.Health < 30 then
lighting.ColorCorrection.Contrast = .2
lighting.ColorCorrection.Saturation = -1
lighting.ColorCorrection.Brightness = 0
heartbeat:Play()
end
if hum.Health > 30 then
lighting.ColorCorrection.Contrast = 0
lighting.ColorCorrection.Saturation = 0
lighting.ColorCorrection.Brightness = 0
heartbeat:Stop()
end
if hum.Health <= 0 then
lighting.ColorCorrection.Contrast = 1
lighting.ColorCorrection.Saturation = -1
lighting.ColorCorrection.Brightness = -.3
heartbeat:Stop()
death:Play()
end
end)