Hello! I started making a Vibe game and i have encountered a problem , the thing is my camera fov changes based on the audio loudness which is good , but it only does for the first song in the playlist , after the song changes it won't work anymore , can you help me?
Playlist script :
local Sound1 = game.Workspace.Sound.Sound1
local Sound2 = game.Workspace.Sound.Sound2
local Sound3 = game.Workspace.Sound.Sound3
local Sound4 = game.Workspace.Sound.Sound4
local Sound5 = game.Workspace.Sound.Sound5
local Sound6 = game.Workspace.Sound.Sound6
local Sound7 = game.Workspace.Sound.Sound7
local Sound8 = game.Workspace.Sound.Sound8
local Sound9 = game.Workspace.Sound.Sound9
local Sound10 = game.Workspace.Sound.Sound10
---------------------------------------------
while true do
wait(1)
Sound1:Play()
Sound1.Ended:Wait()
wait(1)
Sound2:Play()
Sound2.Ended:Wait()
wait(1)
Sound3:Play()
Sound3.Ended:Wait()
wait(1)
Sound4:Play()
Sound4.Ended:Wait()
wait(1)
Sound5:Play()
Sound5.Ended:Wait()
wait(1)
Sound6:Play()
Sound6.Ended:Wait()
wait(1)
Sound7:Play()
Sound7.Ended:Wait()
wait(1)
Sound8:Play()
Sound8.Ended:Wait()
wait(1)
Sound9:Play()
Sound9.Ended:Wait()
wait(1)
Sound10:Play()
Sound10.Ended:Wait()
wait(1)
end
Camera Shake Script :
-- Services
local RunService = game:GetService("RunService")
-- Variables
local Sound1 = workspace.Sound.Sound1
local Sound2 = workspace.Sound.Sound2
local Sound3 = workspace.Sound.Sound3
local Sound4 = workspace.Sound.Sound4
local Sound5 = workspace.Sound.Sound5
local Sound6 = workspace.Sound.Sound6
local Sound7 = workspace.Sound.Sound7
local Sound8 = workspace.Sound.Sound8
local Sound9 = workspace.Sound.Sound9
local Sound10 = workspace.Sound.Sound10
local CurrentCamera = workspace.CurrentCamera
-- Script
local ScreenShakeSettings = {
CameraMinFOV = 75,
CameraMaxFOV = 100,
CameraMaxVolume = 1200
}
game:GetService("RunService").RenderStepped:connect(function()
local CurrentLoudness = Sound1.PlaybackLoudness
local FOV = ScreenShakeSettings.CameraMinFOV + (ScreenShakeSettings.CameraMaxFOV - ScreenShakeSettings.CameraMinFOV) * (CurrentLoudness / ScreenShakeSettings.CameraMaxVolume)
if FOV > 0 and FOV < 130 then
CurrentCamera.FieldOfView = FOV
end
end)
game:GetService("RunService").RenderStepped:connect(function()
local CurrentLoudness = Sound2.PlaybackLoudness
local FOV = ScreenShakeSettings.CameraMinFOV + (ScreenShakeSettings.CameraMaxFOV - ScreenShakeSettings.CameraMinFOV) * (CurrentLoudness / ScreenShakeSettings.CameraMaxVolume)
if FOV > 0 and FOV < 130 then
CurrentCamera.FieldOfView = FOV
end
end)
game:GetService("RunService").RenderStepped:connect(function()
local CurrentLoudness = Sound3.PlaybackLoudness
local FOV = ScreenShakeSettings.CameraMinFOV + (ScreenShakeSettings.CameraMaxFOV - ScreenShakeSettings.CameraMinFOV) * (CurrentLoudness / ScreenShakeSettings.CameraMaxVolume)
if FOV > 0 and FOV < 130 then
CurrentCamera.FieldOfView = FOV
end
end)
game:GetService("RunService").RenderStepped:connect(function()
local CurrentLoudness = Sound4.PlaybackLoudness
local FOV = ScreenShakeSettings.CameraMinFOV + (ScreenShakeSettings.CameraMaxFOV - ScreenShakeSettings.CameraMinFOV) * (CurrentLoudness / ScreenShakeSettings.CameraMaxVolume)
if FOV > 0 and FOV < 130 then
CurrentCamera.FieldOfView = FOV
end
end)
game:GetService("RunService").RenderStepped:connect(function()
local CurrentLoudness = Sound5.PlaybackLoudness
local FOV = ScreenShakeSettings.CameraMinFOV + (ScreenShakeSettings.CameraMaxFOV - ScreenShakeSettings.CameraMinFOV) * (CurrentLoudness / ScreenShakeSettings.CameraMaxVolume)
if FOV > 0 and FOV < 130 then
CurrentCamera.FieldOfView = FOV
end
end)
game:GetService("RunService").RenderStepped:connect(function()
local CurrentLoudness = Sound6.PlaybackLoudness
local FOV = ScreenShakeSettings.CameraMinFOV + (ScreenShakeSettings.CameraMaxFOV - ScreenShakeSettings.CameraMinFOV) * (CurrentLoudness / ScreenShakeSettings.CameraMaxVolume)
if FOV > 0 and FOV < 130 then
CurrentCamera.FieldOfView = FOV
end
end)
game:GetService("RunService").RenderStepped:connect(function()
local CurrentLoudness = Sound7.PlaybackLoudness
local FOV = ScreenShakeSettings.CameraMinFOV + (ScreenShakeSettings.CameraMaxFOV - ScreenShakeSettings.CameraMinFOV) * (CurrentLoudness / ScreenShakeSettings.CameraMaxVolume)
if FOV > 0 and FOV < 130 then
CurrentCamera.FieldOfView = FOV
end
end)
game:GetService("RunService").RenderStepped:connect(function()
local CurrentLoudness = Sound8.PlaybackLoudness
local FOV = ScreenShakeSettings.CameraMinFOV + (ScreenShakeSettings.CameraMaxFOV - ScreenShakeSettings.CameraMinFOV) * (CurrentLoudness / ScreenShakeSettings.CameraMaxVolume)
if FOV > 0 and FOV < 130 then
CurrentCamera.FieldOfView = FOV
end
end)
game:GetService("RunService").RenderStepped:connect(function()
local CurrentLoudness = Sound9.PlaybackLoudness
local FOV = ScreenShakeSettings.CameraMinFOV + (ScreenShakeSettings.CameraMaxFOV - ScreenShakeSettings.CameraMinFOV) * (CurrentLoudness / ScreenShakeSettings.CameraMaxVolume)
if FOV > 0 and FOV < 130 then
CurrentCamera.FieldOfView = FOV
end
end)
game:GetService("RunService").RenderStepped:connect(function()
local CurrentLoudness = Sound10.PlaybackLoudness
local FOV = ScreenShakeSettings.CameraMinFOV + (ScreenShakeSettings.CameraMaxFOV - ScreenShakeSettings.CameraMinFOV) * (CurrentLoudness / ScreenShakeSettings.CameraMaxVolume)
if FOV > 0 and FOV < 130 then
CurrentCamera.FieldOfView = FOV
end
end)

2 comments
I see that here on the post the text allignement is pretty bad , it is good in-studio so that's not the problem causing it.
Please format your code. It makes it easier for us to answer your question(s).