Image not updating ingame?

Hello, I have a talking GUI where it will put text on the screen, with the NPC’s face next to it. Each face is an image, and to change the face when I want, I have this script inside of the GUI that looks for a value in ReplicatedStorage, and once it updates a function will fire determining if the number the Value in ReplicatedStorage associates with a NPC’s decal ID. Here is my script:

local RP = game:GetService("ReplicatedStorage")
local Image = RP:WaitForChild("ImageValue")

	if Image.Value == 1 then
		-- Guard
		script.Parent.Picture.Image = " id)"
	if Image.Value == 2 then
		script.Parent.Picture.Image = " id)"

	if Image.Value == 3 then
		script.Parent.Picture.Image = " id)"
	if Image.Value == 4 then
		script.Parent.Picture.Image = " id)"

I have a main script that changes the Value in replicated storage to each NPC. I checked and the ID actually changes in the GUI when it equals one of these values, but the actual picture will not show on the screen and its just white. If you have any further questions please ask me!

By the way, I use this same strategy with the Text, I have a Value in rep storage called TextValue, and when it changes it knows to update the GUI with the text that’s in the Value. And it works fine.


Edit: Didnt want to give away the ID of the pictures lol


I am going to put my issue into words but simpler. Basically, an Image label is not updating ingame. Forget basically the whole script as it already works, but when the image label is changed, it just does not load the new decal. Thank you and I hope this helps in understanding

Images should be formatted as rbxassetid://id. This is likely your problem, link’s only work if you directly paste them into a object in studio. You will have to use the asset in game. To get that asset id, paste the link into a image label. It will be corrected.

1 Like

@REALTimothy0812 There’s no difference between rbxassetid:// and The former is a shorthand for the latter. Changing the text isn’t going to automatically fix the problem. As for the link part, that’s also incorrect. Studio automatically converts decal assets to image assets (website pages to in-game usable asets).

For what it’s worth, I did notice one thing:

Changed needs to be capital. I’m not sure there’s a lowercase version of changed, even a deprecated one. If you check your console, you might have seen an error.

That’s the only issue I can see with your script. If the value is changed by a server script and you’re listening for the change on a LocalScript, nothing should be wrong here. I’m assuming that because the flow is correct and your text version works, it’s the way you wrote the image one that’s wrong.


The only other way I can think of doing this is just having all of the images stacked on top of eachother already in an ImageLabel and I just need to make them Visible and not Visible when I want to. Also, having changed lowercase does not seem to effect anything else as all my other functions use it and it works fine.
I dont know if the way I am explaining it isnt right, but basically what happens is when the ID actually changes the previous image goes away, and it acts like its trying to load the next one. I will mention sometimes it throws a error stating it could not load the image. I confirmed the ID’s are the correct ones!

1 Like

Here you need to use ContentProvider’s PreloadAsync to preload them after using them:

--Have all of your images been set
local cp = game:GetService("ContentProvider")
cp:PreloadAsync({" id)", " id)", " id)", " id)"})

Btw, you should look into elseif too:

if condition then

elseif condition then

elseif condition then

elseif condition then

end --Only 1 end!
1 Like

Alright i will look into it thanks

Hey again, I put this at the end of the script. Now I am getting this error for all of the assets:

ContentProvider:PreloadAsync() failed for id)

I still do not know why


Okay, this is very weird. I just heard something somewhere saying to set the ID’s back 1 number. I did, and one of them was some random shirt template. But that is not the point, the point is that one worked while the ones I created dont! I made them 2 weeks ago so I have no clue why mine do not work.

If it’s not too much, can you send two of the images?

You talking about the ID’s? Or just putting a picture.

the url of two of the images so I can test it in a baseplate

Wait, does your Changed event even fire? How did you change it?

You’re probably using the wrong id then (note @ReturnBreakEnd: PreloadAsync is never required for anything, it simply pushes assets to the front of the download queue). Two ids exist for image assets: the decal id and the image id. You need the image id. If you copied the numbers from the link in your browser, the image will not load because it’s an invalid game asset.

For some reason for me it’d fully load it if I used PreloadAsync ¯\_(ツ)_/¯
In conclusion yeah, you’ve most probably got the wrong ID.

The image will load if you give it time. PreloadAsync’s only purpose is to download assets that haven’t been used for the first time already and to prioritise the passed assets in the queue. It is not a download bruteforcer.

1 Like

Try changing to rbxassetid://

Hey, I will get you the ID’s at some point today when I get home. Yes, the Changed event fires because it is listening for a changed event in a NumberValue in Replicated Storage.

Hey Colbert, how do I know which ID I am supposed to use?

Also when you get home can you attach a print to the changed event just to make sure?

You’re supposed to use rbxassetid://.