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

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

Asked by 4 years ago

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

Log in to vote
0
Answered by
Dfzoz 489 Moderation Voter
4 years ago
Edited 4 years ago

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.

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. redstonehero 5 — 4y
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. Dfzoz 489 — 4y
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. Dfzoz 489 — 4y
Ad

Answer this question