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

Why is my particle size not changing based on playbackloudness?

I am using this script but its not working, please someone help. I have asked this question before (look at my scriptinghelpers profile.) https://scriptinghelpers.org/questions/86852/how-do-you-change-particle-size-based-of-playbackloudness

Script:

local sound = workspace.Sound
        if sound.IsPlaying then
               script.Parent.Fire.Size = 0.5-((sound.PlaybackLoudness/1000)*1)
end

3 comments

0

Are you using a server script? PlaybackLoudness returns 0 always on the server. You have to do it on a local script.

0

Also did you consider loudness / 1000makes a number to small where subtracting it from 0.5 essentially leaves you with a number almost exactly 0.5?

1 answer

✓ Accepted answer

Try this on for size. Put this in a LocalScript in StarterPlayerScripts. Also make sure to set the sound and fire variables to point to the right places in your Workspace.

local sound = game.Workspace.Sound
local fire = game.Workspace.Part.Fire -- a ParticleEmitter

while true do
	if sound.IsPlaying then
		local number = (sound.PlaybackLoudness / 80) * (1 + sound.Volume)
		print(number)
		
		fire.Enabled = true
		fire.Size = NumberSequence.new(number)
		fire.Speed = NumberRange.new(number + 10)
	else
		fire.Enabled = false
	end
	wait()
end

I found that using a regular Script wasn't able to read the changes in the sound's PlaybackLoudness, IsPlaying, Playing and TimePosition properties. This might be due to the sound actually being played on the client, even though the sound itself is in Workspace.

Also, the Changed event and the GetPropertyChangedSignal method did not work on PlaybackLoudness, IsPlaying, Playing or TimePosition. I wonder if this is a bug or some intentional behavior in the Roblox engine.

5 comments

0

I've tried it but its not working, have you tried it?

0

Found error: 18:00:53.027 - Players.JustSxript.PlayerScripts.LocalScript:10: bad argument #3 to 'Size' (NumberSequence expected, got number)

0

I assumed you were using a Fire object instead of a ParticleEmitter. I updated the code in my answer, so try that!

0

Oh thank you, i'll try it now

0

OMG THANK YOU SO MUCH! IT WORKED!!

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