Answered by
6 years ago Edited 6 years ago
Audio visualizers work by using the PlaybackLoudness
property of a sound. One way you could make a vizualizer would be to make a ScreenGui + Frame
and set the frame's size every RenderStepped
to the PlaybackLoudness of the sound. A script would look something like this
1 | local sound = workspace.Part.Sound |
2 | local frame = script.Parent |
4 | game:GetService( "RunService" ).RenderStepped:Connect( function () |
5 | frame.Size = UDim 2. new( 1 , 0 , 0 ,sound.PlaybackLoudness/ 2 ) |
If you wanted it to be a part, then it would get a little complicated because you would have to change the Size
and CFrame
properties
01 | local part = workspace.Part |
02 | local sound = part.Sound |
03 | local normCF = part.CFrame |
06 | game:GetService( "RunService" ).RenderStepped:Connect( function () |
07 | workspace.Part.CFrame = normCF |
09 | offset = sound.PlaybackLoudness/ 40 |
11 | workspace.Part.Size = Vector 3. new( 1 ,offset, 1 ) |
12 | workspace.Part.CFrame = CFrame.new( 0 ,offset/ 2 , 0 ) |