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

How to set up a loop to set the size of something?

This is the code I have right now but for some weird reason, it is not working. I am trying to visually size a part to the "emitter size" of a sound.

while wait(.2) do
	size = script.Parent.Sound.EmitterSize
	script.Parent.Size = Vector3.new(size, size, size)
end

1 answer

I think you meant to use PlaybackLoudness(number from 0-1000 showing current soundloudness) instead of EmitterSize (how far a sound has to be in 3D space to start attenuating). Thats why size wont change, even if there is no apparent error.

3 comments

0

No, I am trying to have the size of a part change whenever I change the EmitterSize inside the testing "play" mode inside roblox studio.

0

I have copied your code exactly as it is and it worked. You might have to see if something else is interfiring with it, like some other script you made keeping the emittersize. If you made a serverscript and tried to change the emittersize with the screen on client mode it wont work too, because the client won't replicate this change to a server.

0

You also don't have to create a loop. Instead you could use instance.Changed:Connect(function). There is also instance:GetPropertyChangedSignal("PropertyNamehere"):Connect(function), but I don't know why It didnt work with emittersize property specifically.

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