Images in ImageLabels are not loading in

Hey, I’ve been making this script for a tooltip I’m making, and for some reason, the images that I’m loading in aren’t showing up. I’m not getting any errors, and to my knowledge, all the variables and whatnot are rooted correctly. So I don’t know why this is happening. If anyone can help, please do. Thanks a lot in advance.

Code
local vpf = script.Parent.Highlight.ViewportFrame
local highlight = Instance.new("MeshPart", vpf)
local tooltip = script.Parent.Tooltip
local data = game.ReplicatedStorage:WaitForChild("ObjectInformation")
local rs = game:GetService("RunService")
local hovering = script.Hovering.Value
local target
highlight.BrickColor = BrickColor.new("New Yeller")
highlight.Transparency = 1
vpf.CurrentCamera = workspace.Camera

local function funcHighlight(t)
	highlight.Position = Vector3.new(t.Position.X,t.Position.Y,t.Position.Z)
	highlight.MeshId = t.MeshId
	highlight.Transparency = 0
end

event.OnClientEvent:Connect(function(obj,hover,holding)
	if hover == true then
		tooltip.Visible = true
		hovering = true
		target = obj
		if obj:FindFirstChild("InfoType") then
			if obj.InfoType.Value == 1 then
				tooltip.Title.Visible = true
				tooltip.Thumbnail.Visible = true
				tooltip.Thumbnail.Image = "rbxassetid://"..data[obj.Name].ImageID.Value
			else
				if obj.InfoType.Value == 2 then
					tooltip.Title.Visible = true
					tooltip.InfoSmall.Visible = true
					tooltip.Thumbnail.Visible = true
					tooltip.Thumbnail.Image = "rbxassetid://"..data[obj.Name].ImageID.Value
				else
					if obj.InfoType.Value == 3 then
						tooltip.Title.Visible = true
						tooltip.Body.Visible = true
						tooltip.Thumbnail.Visible = true
						tooltip.Thumbnail.Image = "rbxassetid://"..data[obj.Name].ImageID.Value
					else
						if obj.InfoType.Value == 4 then
							tooltip.Title.Visible = true
							tooltip.InfoLeft.Visible = true
							tooltip.InfoRight.Visible = true
							tooltip.Thumbnail.Visible = true
							tooltip.Thumbnail.Image = "rbxassetid://"..data[obj.Name].ImageID.Value
						else
							if obj.InfoType.Value == 5 then
								tooltip.Title.Visible = true
								tooltip.Info1.Visible = true
								tooltip.Info2.Visible = true
								tooltip.Info3.Visible = true
							else
								if obj.InfoType.Value == 6 then
									tooltip.Title.Visible = true
									tooltip.Contents.Visible = true
									for i,v in pairs(obj.Contents:GetChildren()) do
										local content = Instance.new("Frame",tooltip.Contents)
										local text = Instance.new("TextLabel",content)
										local image = Instance.new("ImageLabel",content)
										content.BackgroundColor3 = Color3.fromRGB(135,135,135)
										content.Size = UDim2.new(.9 ,0,.25,0)
										content.BorderColor3 = Color3.fromRGB(11,121,9)
										content.BorderMode = "Middle"
										content.BorderSizePixel = 5
										content.Name = "SubContent"
										content.ZIndex = 2
										text.Text = (v.Name.." - "..v.Measurement.Value..v.Abbreviation.Value)
										text.TextScaled = true
										text.TextXAlignment = "Right"
										text.Size = UDim2.new(.8,0,0,50)
										text.Position = UDim2.new(.1,0,0,0)
										image.Name = "SubThumbnail"
										image.Image = "rbxassetid://"..data[v.Name].ImageID.Value
										image.Size = UDim2.new(.2,0,0,50)
										image.ScaleType = "Fit"
									end
								end
							end
						end
					end
				end
			end
		end
	else
		tooltip.Visible = false
		hovering = false
		target = nil
		for i,v in pairs(tooltip:GetDescendants()) do
			if v.ClassName == "TextLabel" or v.ClassName == "Frame" then
				v.Visible = false
			end
		end
		for i,v in pairs(tooltip.Contents:GetChildren()) do
			if v.ClassName == "Frame" and v.Name == "SubContent" then
				v:Destroy()
			end
		end
	end
end)

rs.Heartbeat:Connect(function()
	if hovering == true then
		tooltip.Position = UDim2.new(0,workspace.CurrentCamera:WorldToViewportPoint(target.Position).X,0,workspace.CurrentCamera:WorldToViewportPoint(target.Position).Y)
	end
end)

As usual, if this is a duplicate of another post, please refer me to it. You guys rock. :+1:

If you’re using the ID in the URL, it won’t work. You’ll have to use the texture.


The best way to get this texture is to paste the link into a Texture and copy the transformed link.

3 Likes

They’re not exactly the same. If I take this random link:
https://www.roblox.com/library/28253178/Walmart-logo-Decal
and enter it into the texture: image
you can see it’s a different ID - one less.

Very interesting! I had no idea that textures functioned differently than other instances. It seems textures get their image data from roblox.com/asset instead of from a rbxassetid.

1 Like

Hey, sorry I didn’t respond quicker. Is it a completely different system, or can I just subtract the id by one? It seems very unintuitive to have it like that.

You could probably subtract it by one. Just give it a shot! Can’t hurt to.

Again, I’m so sorry about my response times but that didn’t seem to work. However, after some more testing I found out that if I were to resubmit the link that was inserted into the ImageLabel, then the image would show up. I don’t know why this would happen though. It just doesn’t make any sense to me.

Edit: I happen to have read the post you made about converting the link into a texture and that seems to have worked! Thank you so much!

1 Like