Hello, The effects I use in my game are conflicting, how can I prevent this? For example, I have now set the stamina system in my game to change the ColorCorrection and FoV of the game when the character gets very tired, but I did the same thing in jumpscare, but when Jumpscare is triggered, it has to change ColorCorrection and FoV. But when both of them happen at the same time, the effects happen and it goes back to its original state immediately. I want this not to happen but I can’t do it, can you help me?
Part of Sprint Code:
task.spawn(function()
local Stamina = humanoid:GetAttribute("Stamina")
if Stamina < 30 and sprinting and HeavyBreathing == false then
if HearthBreakTween then
HearthBreakTween:Cancel()
end
HearthBreakTween = TweenService:Create(game.Lighting.ColorCorrection, TweenServiceInfo, {Contrast = 1, TintColor = Color3.fromRGB(49, 26, 53)})
HearthBreakTween:Play()
HeavyBreathing = true
elseif Stamina > 30 and sprinting and not OverLoaded or HeavyBreathing then
if HearthBreakTween then
HearthBreakTween:Cancel()
end
HearthBreakTween = TweenService:Create(game.Lighting.ColorCorrection, TweenServiceInfo, {Contrast = oldColorCorrectionContrast, TintColor = oldColorCorrectionTintColor})
HearthBreakTween:Play()
HeavyBreathing = false
end
end)
Part of the Jumpscare code:
local LookFigure = RunService.RenderStepped:Connect(function()
cam.CFrame = CFrame.lookAt(cam.CFrame.Position, Figure.CFrame.Position)
end)
local FOV = cam.FieldOfView
local ColorCorrection = game.Lighting.ColorCorrection
local OldTintColor = ColorCorrection.TintColor
local OldContrast = ColorCorrection.Contrast
local OldSaturation = ColorCorrection.Saturation
Humanoid:SetAttribute("Sprintable", false)
TweenCreate:Create(ColorCorrection, Info, {TintColor = Color3.fromRGB(255, 28, 217), Contrast = 0.5, Saturation = 1}):Play()
TweenCreate:Create(cam, Info, {FieldOfView = 30}):Play()
script["Jumpscare Sound Effect"]:Play()
task.wait(4)
Humanoid:SetAttribute("Sprintable", true)
LookFigure:Disconnect()