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?
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