Help with basic ImageOffsets

hello everyone!,

i have ran into a very simple issue, but could find no articles about it.
sorry if this seems like a silly mistake, because it is, i am new to
imageRectOffests and i have no idea how to assign vales to them!

--rectXOFFESETS = {0,170,340,510,680,850}
local imglabel = script.Parent.UserProfile1

while true do
	wait(0.3)
	imglabel.ImageRectOffset =  -- what do i write here???,
end

again, thanks for reading, but i dont have a clue on how to assign them numbers?

any help is appreciated

i have been looking everywhere online and found nothing, hopefully you guys can help me out!

1 Like

imglabel.ImageRectOffset = Vector2.new(xOffset,yOffset)
Replace xOffset and yOffset with the x and y offsets

thanks for the help!, greatly appriciated

Not sure how you didn’t find anything when this is the first google search result when you type in “ImageRectOffset”

ImageRectOffset is a Vector2 with the X being the X offset from the left of the image (in pixels) and Y being the Y offset from the top of the image (also in pixels)

I don’t know what your image looks like but your code should look something like this:

local offsets = {0,170,340,510,680,850}
local imglabel = script.Parent.UserProfile1

local currentOffset = 0
while true do
	wait(0.3)
	imglabel.ImageRectOffset =  Vector2.new(offsets[currentOffset], 0)
    currentOffset += 1
    if currentOffset > #offsets then currentOffset = 0 end
end

You can also use an ipairs for loop if you want

local offsets = {0,170,340,510,680,850}
local imglabel = script.Parent.UserProfile1

while true do
    for i, offset in ipairs(offsets) do
	    wait(0.3)
	    imglabel.ImageRectOffset =  Vector2.new(offset, 0)
    end
end
1 Like

thanks, i also have no idea how i didnt find anyhting, but thanks for the help!, much appriciated