Created
November 15, 2019 05:17
-
-
Save MaximumADHD/10ec410e59ccb27bdc1d2805280e7615 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Grab some services. | |
local Lighting = game:GetService("Lighting") | |
local RunService = game:GetService("RunService") | |
-- Make sure this is running from a LocalScript. | |
if not RunService:IsClient() then | |
error("This should be running in a LocalScript!") | |
end | |
-- Create a Sound object for the music. | |
local music = Instance.new("Sound") | |
music.SoundId = "rbxassetid://1021173702" | |
music.Looped = true | |
music.Volume = 1 | |
music.Name = "Music" | |
-- Create some post processing effects to be used later. | |
local blur = Instance.new("BlurEffect") | |
blur.Parent = Lighting | |
local cc = Instance.new("ColorCorrectionEffect") | |
cc.Parent = Lighting | |
-- Declare an update function. | |
local function update() | |
-- Grab the current PlaybackLoudness of the music. | |
-- This is a number between 0-1000 scoring how loud it currently is. | |
local bass = music.PlaybackLoudness | |
-- Update the Camera's FieldOfView | |
local camera = workspace.CurrentCamera | |
if camera then | |
camera.FieldOfView = 70 + (bass / 100) | |
end | |
-- Update the scene brightness. | |
Lighting.ExposureCompensation = (bass / 300) | |
-- Update the post processing. | |
blur.Size = (bass / 30) | |
cc.Saturation = (bass / 200) | |
cc.Contrast = (bass / 200) | |
end | |
-- Connect the update function to the RunService's Heartbeat. | |
-- This will call the update function 60 times a second. | |
RunService.Heartbeat:Connect(update) | |
-- Play the music! | |
music.Parent = script | |
music:Play() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment