Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

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

This discussion is preserved as it was. New answers, comments, and votes are closed.