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

PlaybackLoudness function not working in game?

local num = 0

function onPlay()
	repeat
	.Parent.Size = num
	num = game.Workspace.DJBooth.Sound.PlaybackLoudness/33.3333333
	wait()
	until false
end
game.Workspace.DJBooth.Sound.Played:connect(onPlay)

1 comment

0

It only works in studio

2 answers

Well, a lot of people do the same mistake, all you have to do is add WaitForChild because in the actual game it probably takes longer to load so it's doesn't work.

Here's the script you should replace it with;

local num = 0
 
function onPlay()
    repeat
    .Parent.Size = num -- Not sure why .Parent?
    num = game.Workspace:WaitForChild("DJBooth").Sound.PlaybackLoudness/33.3333333
    wait()
    until false
end
game.Workspace.DJBooth.Sound.Played:connect(onPlay)

I have no idea what .Parent.Size is but anything else it should work in the actual game now. If this helped please accept answer and upvote

PlaybackLoudness is actually a client-side property. So if this is a server script then the value will not change at all ingame. Sorry!

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