Everything works as intended when the value is below 50, but when its below 25 or at 0 it doesn’t do anything.
I get no errors from this, please help me
Script:
local players = game:GetService("Players")
local player = players.LocalPlayer
local playergui = player.PlayerGui
local TS = game:GetService("TweenService")
local Lighting = game:GetService("Lighting")
local ColorCorrection = Lighting:WaitForChild("ColorCorrection")
local fire = workspace.Campfire:WaitForChild("Fire")
local TickValue = game.ReplicatedStorage.Misc.PlayerTickValue.Value
function Changed()
if script.Value.Value == 100 or script.Value.Value >= 100 then
script.Value.Value = 100
TS:Create(ColorCorrection, TweenInfo.new(1, Enum.EasingStyle.Circular), {Saturation = 0}):Play()
elseif script.Value.Value <= 50 then
TS:Create(ColorCorrection, TweenInfo.new(1, Enum.EasingStyle.Circular), {Saturation = -.5}):Play()
TS:Create(playergui.Vignette.ImageLabel, TweenInfo.new(1, Enum.EasingStyle.Circular), {ImageTransparency = .5}):Play()
elseif script.Value.Value < 25 then
TS:Create(ColorCorrection, TweenInfo.new(1, Enum.EasingStyle.Circular), {Saturation = -1}):Play()
TS:Create(playergui.Vignette.ImageLabel, TweenInfo.new(1, Enum.EasingStyle.Circular), {ImageTransparency = 0}):Play()
elseif script.Value.Value == 0 or script.Value.Value <= 0 then
print("whoops")
player.Character.Torso:BreakJoints()
end
end
while task.wait(1) do
local distance = player:DistanceFromCharacter(fire.Position)
if distance <= 17 then
script.Value.Value = script.Value.Value + TickValue
else
script.Value.Value = script.Value.Value - TickValue
end
script.Value.Changed:Connect(Changed)
end