Why doesn't this work?

Hello so i got this spriting script (a local script)

local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local camera = game.Workspace.CurrentCamera
local runSpeed = 25
local walkSpeed = 14
local isSprinting = false




-- Bind the key "LeftShift" to the function "shiftToSprint"
game:GetService("UserInputService").InputBegan:Connect(function(inputObject)
	if inputObject.KeyCode == Enum.KeyCode.LeftShift then
		shiftToSprint()
	end
end)



-- Bind the key "LeftShift" to the function "shiftToSprint"
game:GetService("UserInputService").InputEnded:Connect(function(inputObject)
	if inputObject.KeyCode == Enum.KeyCode.LeftShift then
		shiftToSprint()
	end
end)



-- Function to switch between sprinting and walking
function shiftToSprint()
	if isSprinting then
		-- Set the speed back to the walk speed
		humanoid.WalkSpeed = walkSpeed
		-- Reset the camera zoom
		camera.FieldOfView = 60
		isSprinting = false
	else
		humanoid.WalkSpeed = runSpeed
		camera.FieldOfView = 65
		isSprinting = true
		wait(5)
		camera.FieldOfView = 60
		humanoid.WalkSpeed = walkSpeed
		game.Lighting.ColorCorrection.Contrast = 0.1
		wait(.00001)
		game.Lighting.ColorCorrection.Contrast = 0.2
		wait(.00001)
		game.Lighting.ColorCorrection.Contrast = 0.3
		wait(.00001)
		game.Lighting.ColorCorrection.Contrast = 0.4
		wait(.00001)
		game.Lighting.ColorCorrection.Contrast = 0.5
		wait(.00001)
		game.Lighting.ColorCorrection.Contrast = 0.6
		wait(.00001)
		game.Lighting.ColorCorrection.Contrast = 0.7
		wait(.00001)
		game.Lighting.ColorCorrection.Contrast = 0.8
		wait(.00001)
		game.Lighting.ColorCorrection.Contrast = 0.9
		wait(.00001)
		game.Lighting.ColorCorrection.Contrast = 1
		script.Enabled = false
		camera.FieldOfView = 60
		wait(5)
		script.Enabled = true
		game.Lighting.ColorCorrection.Contrast = 0
	end
end

and for some reason it doesn’t change the colorCorrection, by the way i made the colorcorrection change the contrast like this because idk how to tween it. Any help?

Is “CurrentCamera” even a thing, if not, it will break the script at that point and won’t go any further.

it is a thing.
image
and the problem is that the script, it just doesn’t change the contrast.

Is there anything in the console?

no there is nothing in the console.

And what is ColorCorrection, is it a property of lighting or an object, because I don’t see a ColorCorrection property?

Idk how to explain so ill just show you a screenshot.

this is what i mean.
image

And, to double check, you have made sure that “Contrast” is a property of ColorCorrection?

wait i just realized that colorcorrection was disabled.

Oh, try enabling it. If it doesn’t work, let me know.

Alright so basically colorcorrection was disabled lol (sry for wasting ur time)

enabling it worked so uhhhhhhh yeah.

By the way ya wanna see the game?

Oh, don’t worry. Glad to hear it’s all working now. Have a good day/night.

Discussions should be on 3rd party services, like Discord. If you want to discuss about it, please add me; dark.2209

i sent you a request on discord.

try using TweenService, like this:

local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local camera = game.Workspace.CurrentCamera
local runSpeed = 25
local walkSpeed = 14
local isSprinting = false
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear)


game:GetService("UserInputService").InputBegan:Connect(function(inputObject)
	if inputObject.KeyCode == Enum.KeyCode.LeftShift then
		shiftToSprint()
	end
end)


game:GetService("UserInputService").InputEnded:Connect(function(inputObject)
	if inputObject.KeyCode == Enum.KeyCode.LeftShift then
		shiftToSprint()
	end
end)


function shiftToSprint()
	if isSprinting then
		
		humanoid.WalkSpeed = walkSpeed
		
		camera.FieldOfView = 60
		isSprinting = false
		
		local tween = game:GetService("TweenService"):Create(
			game.Lighting.ColorCorrection,
			tweenInfo,
			{ Contrast = 0 }
		)
		tween:Play()
	else
		humanoid.WalkSpeed = runSpeed
		camera.FieldOfView = 65
		isSprinting = true
		
		local tween = game:GetService("TweenService"):Create(
			game.Lighting.ColorCorrection,
			tweenInfo,
			{ Contrast = 1 }
		)
		tween:Play()
	end
end