Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

When I set the image of an ImageLabel it doesn't show?

Asked by
U_srname 152
4 years ago

So I'm trying to make a round based game with images for every single minigame. The issue is, when I try to set the image of the ImageLabel, it doesn't show!

Here's the script I tried:

local ids = {
    397558836,
    32348996,
    477764158
}

local chosen = math.random(1, #ids)

script.Parent.Image = 'rbxassetid://'..tostring(ids[chosen])

The problem is that I'm not getting any error message. The Image just won't show. If I check the properties of the ImageLabel, it show that the image is 'rbxassetid://chosenid'.

I'm very confused...

0
For the image to be able to load, you need an image id. You can get this by pasting the id into a decal object in studio or subtracting 1 until you get it. pidgey 548 — 4y
0
They are actual image ids U_srname 152 — 4y
0
Did you double check to make sure the images went through moderation first? Hwk3rAlt 14 — 4y
0
check my answer, that should answer your question Elixcore 1337 — 4y

2 answers

Log in to vote
0
Answered by
Elixcore 1337 Moderation Voter
4 years ago

The problem in here is that the IDs are not link to the images, they are links to the decals, therefore they do not load since you need the images.

To obtain the images, go to the id and subtract 1 from it (Example: 397558836 is actually 397558835)

I confirmed this worked for the first 2.

0
what about the last? U_srname 152 — 4y
0
same for the last, it's 477764157 Elixcore 1337 — 4y
0
oh thanks U_srname 152 — 4y
Ad
Log in to vote
0
Answered by
Veuyz 0
4 years ago

I am not a very experienced scripter. But from what I've seen. When you load whatever game that uses local images and image label. The usual "rbxassetid://" is converted to "gameasset://". Since you can not use "gameasset://" to load your images, just do the following.

local ids = {
    "rbxassetid://397558836",
    "rbxassetid://32348996",
    "rbxassetid://477764158"
}

local chosen = math.random(1, #ids)

script.Parent.Image = ids[chosen]

When the game will start, it will convert the "rbxassetid://" to "gameasset://" and normally, will load the images.

I am not very good at explanation but I hope you understood.

0
I do not think this is the problem. Elixcore 1337 — 4y
0
also what you said about gameasset is incorrect. Elixcore 1337 — 4y

Answer this question