Problem with ImageLabel

Hi all developers, i’m new in this forum and i need help for a thing.
The problem is the ImageLabel.

Normally when i put (Variable.ImageLabel.Image = “http://www.roblox.com/asset/?id=”…module.imageID) it normally shows the image(in my other game) but there nope.
I tried to put (“rbxassetid://”…duck.imageID) or (“http://www.roblox.com/asset/?id=”…duck.imageID) or only (duck.ImageID) but all of these didn’t work, only white background.

There are no errors in the console.

This is the local script that clone the template for all the ducks in the module script:

local Ducks = require(game:GetService("ReplicatedStorage").DucksUIHandler.Ducks)
local BadgeService = game:GetService("BadgeService")

for _, duck in ipairs(Ducks) do
	local duckFrame =game.ReplicatedStorage.DucksUIHandler.Template:Clone()
	duckFrame.Parent = script.Parent.Frame.Container
	duckFrame.Name = duck.ID
	duckFrame.ImageLabel.Image = "http://www.roblox.com/asset/?id="..duck.imageID 
	duckFrame.DifficultyLabel.Text = duck.difficulty
	duckFrame.Namef.Text = duck.name
	if BadgeService:UserHasBadgeAsync(game.Players.LocalPlayer.UserId, duck.badgeID) then
		duckFrame.BackgroundColor3 = Color3.fromRGB(0, 255, 0) 
	else
		duckFrame.BackgroundColor3 = Color3.fromRGB(255, 0, 0) 
	end
end

This is the module script i use to put the name/difficulty/imageID/badgeID/ID(name without spaces):

local Ducks = {
	{
		ID = "NormalDuck",
		name = "Normal Duck",
		difficulty = "Easy",
		badgeID = 2129399897,
		imageID = "11552766665",
	},
	{	
		ID = "TreeDuck",
		name = "Tree Duck",
		difficulty = "Easy",
		badgeID = 2129400307,
		imageID = "11552821903",
	},
	{
		ID = "WaterDuck",
		name = "Water Duck",
		difficulty = "Easy",
		badgeID = 2129400213,
		imageID = "11552864141",
	},
	{
		ID = "PondDuck",
		name = "Pond Duck",
		difficulty = "Easy",
		badgeID = 2129410424,
		imageID = "11550745222",
	},
	
}

return Ducks

I might be wrong, but your “imageID” variable should not be a string when used this way.

You can do one of two things:

  • Remove the quotations from all the imageIDs

OR

I removed the quitations from all numbers but it’s the same D:

I’m not too good at scripting, how do i use tonumber() function? Thanks!

If that is not the issue then completely scrap the tonumber() solution! Instead, I think I may have found your problem. How are you getting the ID for the images? To fix your problem, locate your image in the toolbox, right click on it, and click “Copy Asset ID”.

image

I replicated your issue and it seems to be a problem with the ID itself.

Tree Duck example:
image

As you can see, the ID you reference in the script is not the same when you manually paste it into the Image property.

I tried to get any image Asset ID from the toolbox and paste in the script and it works! Thanks you so much for help :smiley:

1 Like

But i have another question, how do i do if i have the link? Like this

do i need to get the number in the link? or maybe i need to be verified?

Thanks!

I’m a bit confused on what you mean. Are you asking how to get the ID from the link via script?

If you’re asking in the way I’m interpreting your reply (probably not) then simply use this url when handling your images via script:

rbxthumb://type=Asset&id=YourDecalID&w=420&h=420

This URL should convert any decal ID into an asset ID that can be used with the image property!

Sorry for confusion, i saw now that my image is a “Decal” and not “Image”.

Is it the same or is that the problem? Thanks!

They are basically the same. The image asset gets uploaded when the decal asset does. The only difference is the ID and like I said before, the image property can only be used with the image ID! Another way to get this ID manually is to paste the decal’s ID into the Image property under any instance with it (ImageLabel, ImageButton, Decal, Etc…). The Image ID should appear at the end.

Example (Using your Tree Duck decal):

What I enter:
image

The outcome:
image

Ok thank you so much for help!

Have a great day!

:smiley:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.