Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Why doesn't my repeat stop after it reaches it's goal?

Asked by 3 months ago

Issue

The issue is quite simple, the repeat doesn't stop when it reaches my desired goal. The Volume Default Value is 1. It starts at 0 and slowly rises.

The Error part of the script

        repeat 
            Audio.Volume = Audio.Volume + 0.1
            wait(0.5)
        until Audio.Volume == Volume

2 answers

Log in to vote
2
Answered by 3 months ago
Edited 3 months ago

Have you tried '>='? The issue could be that it's going over your Volume value and therefore it's never going to be equal to Volume. Using '>=' (Over or equal) will detect if it is either over, or equal to Volume. If it is, then it will stop the Loop.

repeat 
    Audio.Volume = Audio.Volume + 0.1
    wait(0.5)
until Audio.Volume >= Volume
0
Nice explanation Nguyenlegiahung 1070 — 3mo
Ad
Log in to vote
0
Answered by 3 months ago

I think you should change == to >= for it to work

repeat
        Audio.Volume = Audio.Volume + 0.1
        wait(0.5)
    until Audio.Volume >= Volume

Answer this question