Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make the brickcolor go with the loudness of the music smoothly?

Asked by
manfai 2
5 years ago
Edited 5 years ago
01game:GetService("RunService").RenderStepped:Connect(function()
02local loudness = workspace.Songs.MusicPlayer.PlaybackLoudness
03if loudness >= 100 then
04game.Workspace.test1.Material = "Neon"
05game.Workspace.test1.BrickColor = BrickColor.new "Teal"
06else
07game.Workspace.test1.Material = "Metal"
08game.Workspace.test1.BrickColor = BrickColor.new "Really black"
09end
10end)

I know how to make it go with the loudness but is there a way to make the colors change smoothly?

test1 = a brick

3 answers

Log in to vote
0
Answered by 5 years ago

In order to make it run smoothly, you could take advantage of Color3s.

Color3.new(r,g,b) and Color3.fromRGB(r,g,b) allow you to construct a color by simply plugging in numbers to the constructor. If you run BrickColor.new(Color3), you then get a brick color from that Color3.

As a result, you could simply write a function that calculates r,g,b values based on loudness and use that to create a Color3.

Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

I found a way that could make the brickcolor change smoother (by using Color3 and set the value to playbackloudness of the audio: But it couldn't change the material

01local loudness = workspace.Songs.MusicPlayer.PlaybackLoudness + 0 -- Change the amount if needed to make the brick brighter / darker
02 
03game:GetService("RunService").RenderStepped:Connect(function()
04    game.Workspace.test1.Color= Color3.new(loudness ,loudness ,loudness)
05if loudness >= 100 then
06    game.Workspace.test1.Material = "Neon"
07end
08    if loudness <= 50 then
09        game.Workspace.test1.Material = "Metal"
10    end
11end)

I hope this would help you :D I haven't checked it yet..if it didn't help.................sorry

Log in to vote
0
Answered by 5 years ago

Use Tweenservice, there's no need for renderstepped here or anything, read up on how to make a rainbow effect here and just change it to the colors you want.

https://devforum.roblox.com/t/how-to-create-a-simple-rainbow-effect-using-tweenservice/221849

Answer this question