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

Script always says playbackloudness is 0?

When I play an audio, the script always says playbackloudness is 0, although the playbackloudness is not 0 How can I fix this?

local RunService = game:GetService("RunService")
 local sound = script.Parent.Sound
local player = game.Players.LocalPlayer
local radio = script.Parent
local pbl
RunService.RenderStepped:Connect(function()
	 pbl = sound.PlaybackLoudness
	print(sound.PlaybackLoudness)
	if pbl >1 then
		print("too loud")
	end
end)

2 comments

0

are you running this on a local script or a server script?

0

^^^render stepped and local player..... is your sound playing?

1 answer

Well after checking with the :GetPropertyChangedSignal, which oddly enough doesn't seem to work for this (PlaybackLoudness is Read-Only, so you can't change it manually), you can definitely use a while-loop to print the "pbl"

Local Script

local player = game:GetService("Players").LocalPlayer
local radio = script.Parent
local sound = radio:WaitForChild("Sound")

while true do
	local pbl = sound.PlaybackLoudness
	if pbl > 1 then
		print("Too Loud", pbl)
	end
	wait()
end

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