ImageLabel changes in script but not in-game

Hello!

I’m having a bit of an issue with updating an ImageLabels image. I’ve been looking up similar problems but there seem to be no solutions that work. Here is my script:

for i,v in pairs(game.ReplicatedStorage.BackgroundImages:GetChildren()) do
			
			if i == count then
				
				player.PlayerGui.Background.BackgroundImage.Image = idSyntax..v.Value

                print(player.PlayerGui.Background.BackgroundImage.Image)
			end
		end

idSyntax variable:

local idSyntax = "rbxassetid://"

There is more to the script, but from the print functions I know that nothing else is the problem. The second print’s output even shows that the image label is changing according to what I wrote, despite it not being in-game. The Image IDs are also correct.

So confused, thanks in advance

What are the children of game.ReplicatedStorage.BackgroundImages?

1 Like

You could try changing "rbxassetid://" to "rbxthumb://type=Asset&id=[ImageId]&w=[Width]&h=[Height]", this is normally the issue for me:

local idSyntax = "rbxthumb://type=Asset&id=%d&w=420&h=420"

for i, v in pairs(game.ReplicatedStorage.BackgroundImages:GetChildren()) do
	if i == count then
		player.PlayerGui.Background.BackgroundImage.Image = idSyntax:format(v.Value)
		
		print(player.PlayerGui.Background.BackgroundImage.Image)
	end
end

For more information on supported heights, check this topic. Other than that, another reason I could think of is having the wrong asset id.

1 Like

Multiple string values with asset IDs

1 Like

That worked! I never saw anything on that change but it will be good to know from now on, thank you !