I'm making a camera effect where the FOV reacts to the music. I also have shift to sprint function which also changes the FOV, when both are running, the FOV for the sprint function doesn't work. I have tried placing variables to stop them running both at the same time but it still doesn't work. This is my sprint script:
-- Sprinting Function when left shift presed local function beginSprint(input, gameProcessed) if not gameProcessed then if input.UserInputType == Enum.UserInputType.Keyboard then local keycode = input.KeyCode if keycode == Enum.KeyCode.LeftShift then player.Character.Humanoid.WalkSpeed = sprintSpeed cameraSprintTween:Play() end end end end -- Walking Function when left shift released local function endSprint(input, gameProcessed) if not gameProcessed then if input.UserInputType == Enum.UserInputType.Keyboard then local keycode = input.KeyCode if keycode == Enum.KeyCode.LeftShift then player.Character.Humanoid.WalkSpeed = walkSpeed cameraWalkTween:Play() end end end end userInput.InputBegan:Connect(beginSprint) userInput.InputEnded:Connect(endSprint)
And this is the code for the Music-camera FOV reaction
local musicTweenInfo = TweenInfo.new( 0.05, -- Length(seconds) Enum.EasingStyle.Sine, -- Easing Style Enum.EasingDirection.InOut -- Easing Direction ) while wait(0.02) do local loundess = sound.PlaybackLoudness/200 if loundess > loundess/2 then local cameraProperties = {FieldOfView = 70 + loundess} local cameraMusicTween = game:GetService("TweenService"):Create(game.Workspace.CurrentCamera, musicTweenInfo, cameraProperties) cameraMusicTween:Play() end end