So I'm making a FieldOfView manipulator script using the PlaybackLoudness feature. The problem is, it all works in Studio, but none of it works in server. Could someone help me figure out this problem? Thanks!
Script:
local Sound = game.Soundscape.Music local Part = game.Workspace.CurrentCamera while true do local x = game.Workspace.Light.Value.Value/20 + 70 --This is basically the PlaybackLoudness in a NumberValue. wait(0.001) Part.FieldOfView = x end
Camera manipulation code will only work in a live server from a LocalScript. This is because the Server's Camera doesn't render anything and is not replicated, for obvious reasons. You have to edit each Client's camera.
LocalScripts won't run just anywhere. Listed on this page at the top is where you can put a LocalScript and have it run.
Since the Client may not have loaded everything when Scripts are run, you may have to use WaitForChild
on various objects, for instance game.Workspace.Light.Value
might need to be: game.Workspace:WaitForChild("Light"):WaitForChild("Value")