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

Wait breaking help?

Asked by
NotSoNorm 777 Moderation Voter
8 years ago

I have this script that changes the wait based on the pitch, for some reason it goes past 120 UDim2 and goes really fast

local Audio = game.Workspace.Timer.Sound
local PitchLevel = Audio.Pitch
local Length = Audio.TimeLength

Audio.Changed:connect(function(SoundId)
    for i = 0,120, 1 do
            local diffrence = PitchLevel - 1
        wait(1 - diffrence)
        if Audio.IsPlaying == true then
            script.Parent.Size = script.Parent.Size + UDim2.new(0,1,0,0)
        else
            script.Parent.Size = UDim2.new(0,0,0,0)
            break
        end
    end
end)

1 answer

Log in to vote
0
Answered by 8 years ago

try to do:

wait(difference = difference - 1)
0
or just do: while difference > 1 do. Thats another loop you could try :) Alucifer 45 — 8y
Ad

Answer this question