Dont know any of the code for this, please help.
COMMUNITY QUESTION
How to make a parts size change when sound is loud?
1 answer
Here you go, I hope this helps!
wait();
local TweenService = game:GetService("TweenService");
local soundId = 00000000;
local tweenInfo = TweenInfo.new(
0.06,
Enum.EasingStyle.Quad
);
local Part = Instance.new("Part");
Part.BrickColor = BrickColor.Red();
Part.Size = Vector3.new(10,10,10);
Part.Position = Vector3.new(0,20,0);
Part.Anchored = true;
Part.TopSurface = Enum.SurfaceType.Smooth;
Part.BottomSurface = Enum.SurfaceType.Smooth;
Part.Parent = workspace;
local Sound = Instance.new("Sound");
Sound.SoundId = soundId
Sound.Volume = 1;
Sound.Parent = Part;
local lastTween = nil;
repeat wait(); until (Sound.IsLoaded);
Sound:Play();
local function loudnessChanged()
local Loudness = Sound.PlaybackLoudness;
local Math = (10*Loudness/5)
local Vec = Vector3.new(Math,Math,Math);
local Tween = TweenService:Create(Part,tweenInfo,{Size = Vec}):Play();
if (lastTween) then
lastTween:Destroy();
end;
lastTween = Tween;
end;
Sound:GetPropertyChangedSignal("PlaybackLoudness"):Connect(loudnessChanged);
1 comment
0
not quite... but KEEP SCRIPTING!!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Do you mean change the size of the part when the volume increases? Or do you mean when the player gets closer to the source of the sound?
When the volume increases