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

How to alternate ImageRectOffset with loop?

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

✓ Accepted answer

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)

1 comment

0

thx

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