so im trying to make a script which increased/decreases players fov based on songs volume.
local cam = workspace.CurrentCamera local sound = workspace.Song if sound.IsPlaying == true then while true do wait() cam.FieldOfView = 70 + (sound.PlaybackLoudness / 50) end end
is there any way to make it work or make it better? also its a local script but thats not the matter.
I'm not sure if this will be the exact solution to your problem, but while true do will cause a Game script timeout. Do this:
local cam = workspace.CurrentCamera local sound = workspace.Song if sound.IsPlaying == true then while **wait()** do wait() cam.FieldOfView = 70 + (sound.PlaybackLoudness / 50) end end
While wait() do runs the script so that it won't execute too fast. Also don't put a number in the parenthesis.