PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Image

ImageLabel

Content

The Image property is a content-type property that should hold the asset ID of a Decal or Image on the Roblox website. It functions identically to Decal/Texture with regards to loading the image from the Roblox website. The rendered image will be colorized using ImageLabel/ImageColor3. It is possible to further manipulate the rendered image into sliced (ImageLabel/SliceCenter), tiled (ImageLabel/ScaleType) and nine-slice images using other image properties.


Code Samples


Image Hover Lock

This code sample causes an ImageLabel/ImageButton to display a red padlock. When the mouse is hovered, it changes to a green unlocked padlock.

local imageLabel = script.Parent

-- The images in this example are 64x64
imageLabel.Size = UDim2.new(0, 64, 0, 64)

local function unlock()
	imageLabel.Image = "rbxassetid://284402785" -- Unlocked padlock (64x64)
	imageLabel.ImageColor3 = Color3.new(0, 0.5, 0) -- Dark green
end

local function lock()
	imageLabel.Image = "rbxassetid://284402752" -- Locked padlock (64x64)
	imageLabel.ImageColor3 = Color3.new(0.5, 0, 0) -- Dark red
end

-- Connect events; our default state is locked
imageLabel.MouseEnter:Connect(unlock)
imageLabel.MouseLeave:Connect(lock)
lock()