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.
@REALTimothy0812 There’s no difference between rbxassetid://
and https://www.roblox.com/asset/?id=
. 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!
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({"http://www.roblox.com/asset/?id=(the id)", "http://www.roblox.com/asset/?id=(the id)", "http://www.roblox.com/asset/?id=(the id)", "http://www.roblox.com/asset/?id=(the id)"})
Btw, you should look into elseif
too:
if condition then
elseif condition then
elseif condition then
elseif condition then
end --Only 1 end!
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 http://www.roblox.com/asset/?id=(the id)
I still do not know why
EDIT:
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.
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://.
Problem solved! Sorry guys for being gone for 4 days, but I fixed the issue. I made them assets instead and that worked just fine. Thanks though!