Sprites dissapearing?

I was attempting to create a loading circle using a sprite sheet with ImageOffset, and although it worked in Studio when I changed the offset manually, once I get into actually testing the game, the image does not appear at all.

This is the sprite sheet that I am using:

Example of what the first sprite looks like:

image

What shows whenever I play the game in Studio:

image

Here is the code that I am using:

local function getSpritePosition(spriteNumber)
	local row = math.floor((spriteNumber - 1))
	local position = Vector2.new(row*35, 40)
	return position
end

spawn(function()
	while loading do
		UI.LoadingScreen.ImageLabel.ImageRectOffset = getSpritePosition(i%29 + 1)
		i = i + 1
		wait(0.1)
	end
end)
-- Credit to whoever posted this on DevForum

I am wondering that this issue could be caused because I am using scale for the size of the ImageLabel, and the image is using offset measurements?

1 Like

Well if you are using the first size arguments (such as (0.5,0) ), this will cause the positions and sizes to change in unwanted ways, so make sure you are sizing this via Pixels (0,124).

Other than that, I’m not sure what the problem is :man_shrugging:

If you want to use scale for the ImageLabel (which is a good thing), then you can use an sprite-sheet iterator that accounts for size. I made an iterator for this: wow cool tweet bro - Pastebin.com

1 Like

Then I was right that the scale messes up the pixel measurements, I will try this out, thank you!