Hello! My name is Isaak and I’m a new scripter! I’ve been trying out some new things with PlaybackLoudness like volume and size, but there’s one thing I’ve been looking for but can’t find.
How do I make the FOV zoom in when the PlaybackLoudness value gets higher? I know how to make it zoom out but not zoom in.
If youre trying to make the FOV smaller (make it look like it’s zooming in), then youre going to need to subtract the original FOV from the playbackLoundess
local originalFOV = workspace.CurrentCamera.FieldOfView
workspace.CurrentCamera.FieldOfView = originalFOV - Sound.PlaybackLoudness/10
obviously you’re going to need to make this code execute all the time to update the FOV constantly so (if you havent already) use a RenderStepped event.
The method that TDtheTV pointed out will unfortunately not work since multiplying the playback loudness will only make the FOV have an even more “zoomed out” effect.
Hi, best way to do that imo is to get a multiplier.
local DEFAULT_FOV = 70
local MAX_PLAYBACK_LOUDNESS = 200 -- May need to change for individual sounds
RunService.RenderStepped:Connect(function()
camera.FieldOfView = DEFAULT_FOV - (DEFAULT_FOV * math.clamp(playbackLoudness / MAX_PLAYBACK_LOUDNESS), 0, 1))
end)
Consider 0-1 a percentage. If the max playback loudness is achieved then it will zoom in completely, you can modify the clamp min/max to change the max zoom.
Be careful with this method. PlaybackLoudness is a value ranging from 0-1000. The FOV is usually 70, so this will cause issues if the loudness exceeds 700. You also don’t have proper control over the max zoom