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

How to alternate ImageRectOffset with loop?

Asked by 2 years ago

I want to run a loop that changes a image's RectOffset until the loop ends, problem is the ImageRectOffset only changes once.

local downshoot = game.Workspace.Shoot1.DownShoot.Value
    while downshoot == false do
    faces2.ImageRectOffset = Vector2.new(340,0)
    wait(0.4)
    faces2.ImageRectOffset = Vector2.new(0,0)
    end
end)

1 answer

Log in to vote
1
Answered by 2 years ago
Edited 2 years ago

I believe you should add in another wait() after the 5th line. the loop runs through and the immediately starts over again, there is no wait between the 5th line and the 3rd line so its as if it doesn't change at all. Try something like this:

local downshoot = game.Workspace.Shoot1.DownShoot.Value
    while downshoot == false do
    faces2.ImageRectOffset = Vector2.new(340,0)
    wait(0.4)
    faces2.ImageRectOffset = Vector2.new(0,0)
    wait(0.4)
    end
end)
0
thx SilverishReign 75 — 2y
Ad

Answer this question