Simple Script Not Working As Intended

Hello developers! :grinning_face_with_smiling_eyes:

I have a simple question… I am trying to make a text label display the current volume value of a specific sound in studio. The sound volume can change based on if the player increases it or not using buttons. However, how do I make a local script that constantly updates the volume value on the text label when needed?

Here is the script I wrote and is not working even though it seems as if it should…

Any thoughts?

1 Like

You need to have a wait() in all while loops.
The fixed version is below.

local Volume = script.Parent
local Sound = workspace.AnotherLove

while true do
Volume.Text = "Current Volume: " .. Sound.Volume

Any loop in any programming language MUST have an interval. In this case a wait(…). The loop crashes the engine as it runs forever without any interval.

FIX… add an interval in the loop.
To prevent lag and crashes. Please add an interval in ANY loop.

Oops, forgot the most important small factor.