Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Wait breaking help?

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

try to do:

wait(difference = difference - 1)

1 comment

0

or just do: while difference > 1 do. Thats another loop you could try :)

This discussion is preserved as it was. New answers, comments, and votes are closed.