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

How am i going to stop the the loop in an exact time i want?

Asked by 5 years ago

This is the script. i want to break the loop in like 1.25 seconds

        while wait() do
            print(player)
        hum.BodyDepthScale.Value=hum.BodyDepthScale.Value+0.1
        hum.BodyWidthScale.Value=hum.BodyDepthScale.Value+0.1
        hum.BodyHeightScale.Value=hum.BodyHeightScale.Value+0.1
        hum.HeadScale.Value= hum.HeadScale.Value+0.1
        end

but when i put

        while wait() do
            print(player)
        hum.BodyDepthScale.Value=hum.BodyDepthScale.Value+0.1
        hum.BodyWidthScale.Value=hum.BodyDepthScale.Value+0.1
        hum.BodyHeightScale.Value=hum.BodyHeightScale.Value+0.1
        hum.HeadScale.Value= hum.HeadScale.Value+0.1\
    ------wait(1.25)
    ------break
        end

it stop instantly? THANKYOU IN ADVANCE.

1 answer

Log in to vote
1
Answered by 5 years ago

It probably isn't the most practical, but you could run a spawn function or coroutine that breaks the loop after waiting 1.25 seconds.

local BreakLoop = false

spawn(function()
    wait(1.25)
    BreakLoop = true
end)

repeat wait()
    --do stuff
until BreakLoop
Ad

Answer this question