Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I am trying to make the Screen bounce to the beat of the music but how do I do it?

I have tried doing a script but I haven't been successful any of the times I tried. l

local Client = {
ScreenShakeSettings = {
        CameraMinFOV = 72,
        CameraMaxFOV = 70,
        CameraMaxVolume = 1000
}
}

local Settings = Client.ScreenShakeSettings
local SoundObject = workspace.GLOBAL_SOUND
local CurrentLoudness = SoundObject.PlaybackLoudness
local FOV = Settings.CameraMinFOV + (Settings.CameraMaxFOV - Settings.CameraMinFOV) * (CurrentLoudness / Settings.CameraMaxVolume)
if FOV > 0 and FOV < 120 then
    workspace.CurrentCamera.FieldOfView = FOV
end

2 comments

0

Can you post the script?

0

Yep

2 answers

✓ Accepted answer

So, there's two soups: The scripting-friendly one, and the audio-software friendly one.

I recommend the first unless you're up for a slight challenge, so I'll detail it below: Use PlaybackLoudness.

PlaybackLoudness tells you how "loud" a sound is being at a given timeframe, and it's a number between 0 and 1000, inclusive.

As to making the "screen bounce", you'd have to elaborate more on that!

I'd personally try to CFrame the camera by an offset determined by

math.random()*Loudness*Multiplier 

-on both X and Y axis each RenderStep, preferably with a multiplier <1, but that's just me.

Try and experiment, that's all I can tell you without further info on what you're trying.

local Client = {
ScreenShakeSettings = {
        CameraMinFOV = 72,
        CameraMaxFOV = 70,
        CameraMaxVolume = 1000
}
}

local Settings = Client.ScreenShakeSettings
local SoundObject = workspace.GLOBAL_SOUND
local CurrentLoudness = SoundObject.PlaybackLoudness
local FOV = Settings.CameraMinFOV + (Settings.CameraMaxFOV - Settings.CameraMinFOV) * (CurrentLoudness / Settings.CameraMaxVolume)
if FOV > 0 and FOV < 120 then
    workspace.CurrentCamera.FieldOfView = FOV
end

This is the script I have.

This discussion is preserved as it was. New answers, comments, and votes are closed.