Im trying to make a script for my beams witch goes to music and can like strobe on bass maybe is that possible if so how?
You can check loudness Sound | Documentation - Roblox Creator Hub
just says zero all the time idk why i did it as print to test
yh the playback loudness is just greyed out
Have you tried out the example script they gave in the documentation at the very bottom @rokoblox5 sent you? It should work.
i need it to not create it instead go from one already created
Make sure your Sound object is playing.
That’s because the property is read-only
, meaning that you can only read the value, and not edit it.
You could use the code that is provided, and make some simple edits, such as redefining the bar
variable to your part/beam, and replacing the assigned Size
variable with a Vector3 value.
how can i make it not read only?
You cannot, it just tells you how loud is the music right now, if you want to change the volume you would do Sound.Volume
, which is a read & write property
Sound.PlaybackLoudness
would return a number from 1 to 1000 to tell you how loud is your audio
To elaborate on what @rokoblox5 said, the property PlaybackLoudness
is sort of like the Speed
value of a car; It only shows a number when the car is moving. PlaybackLoudness
, only shows a number when the audio is playing. The reason it’s read-only is that it’s designed so that you can make changes based on the current value of PlaybackLoudness
.
Here’s a basic example of how you would do this.
-- LocalScript in PlayerGui
local part = workspace.Part -- path to part
local audio = part.Audio -- path to sound object
local sensitivity = 10 -- sensitivity to the loudness
local RS = game:GetService("RunService")
RS.RenderStepped:Connect(function() -- fires every frame
local newSize = audio.PlaybackLoudness/(sensitivity*10)
part.Size = Vector3.new(newSize,newSize,newSize)-- sizes the part according to loudness
end)
audio:Play() -- starts the audio, which then causes the PlaybackLoudness value to start changing
Greyed out means it’s a Read-Only variable. You can’t edit it, but you can still read it.