What is wrong with this code

So I’m trying to code this sound that increases when you start a boat, then decreases when you stop it. It works decreasing because the script waits until the volume is 0. Since sounds volume can’t go negative, it works fine. But this part of the script to increase the volume is supposed to wait until the volume is .2, then stop increasing it, although instead it just goes higher and higher than it’s supposed to and I have no idea why it does this.

repeat
	Sound.Volume += .02
	wait(.1)
until Sound.Volume == .2
while Sound.Volume < 0.2 do
    Sound.Volume += 0.02
    wait(0.1)
end
1 Like

Didn’t seem to do anything different.

Not sure what’s happening but try putting the wait(.1) before the Sound.Volume += 0.2 part?

I don’t actually know what edit you made, but it works fine now!

1 Like

I replaced == with <