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
4 years ago
Edited 4 years ago
game:GetService("RunService").RenderStepped:Connect(function()
local loudness = workspace.Songs.MusicPlayer.PlaybackLoudness
if loudness >= 100 then
game.Workspace.test1.Material = "Neon"
game.Workspace.test1.BrickColor = BrickColor.new "Teal"
else
game.Workspace.test1.Material = "Metal"
game.Workspace.test1.BrickColor = BrickColor.new "Really black"
end
end) 

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 4 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 4 years ago
Edited 4 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

local loudness = workspace.Songs.MusicPlayer.PlaybackLoudness + 0 -- Change the amount if needed to make the brick brighter / darker

game:GetService("RunService").RenderStepped:Connect(function()
    game.Workspace.test1.Color= Color3.new(loudness ,loudness ,loudness)
if loudness >= 100 then
    game.Workspace.test1.Material = "Neon"
end
    if loudness <= 50 then
        game.Workspace.test1.Material = "Metal"
    end
end)

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 4 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