Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my particle size not changing based on playbackloudness?

Asked by 5 years ago
Edited 5 years ago

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
0
Are you using a server script? `PlaybackLoudness` returns 0 always on the server. You have to do it on a local script. EpicMetatableMoment 1444 — 5y
0
Also did you consider `loudness / 1000`makes a number to small where subtracting it from `0.5` essentially leaves you with a number almost exactly `0.5`? EpicMetatableMoment 1444 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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.

0
I've tried it but its not working, have you tried it? JustSxript 36 — 5y
0
Found error: 18:00:53.027 - Players.JustSxript.PlayerScripts.LocalScript:10: bad argument #3 to 'Size' (NumberSequence expected, got number) JustSxript 36 — 5y
0
I assumed you were using a Fire object instead of a ParticleEmitter. I updated the code in my answer, so try that! WillieTehWierdo200 966 — 5y
0
Oh thank you, i'll try it now JustSxript 36 — 5y
0
OMG THANK YOU SO MUCH! IT WORKED!! JustSxript 36 — 5y
Ad

Answer this question