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

Putting Images on the Screen

Putting Images on the Screen

Jun 29 2018, 4:50 PM PST

Problem

You want to create a GUI image and place it in a game.

Solution

Create an ImageLabel and change its Image property.

local screen, image = Instance.new('ScreenGui'), Instance.new('ImageLabel')
 
screen.Parent = game.StarterGui
image.Parent = screen
 
image.Position = UDim2.new(.375, 0, .375, 0)
image.Size = UDim2.new(.25, 0, .25, 0)
image.Image = 'http://www.roblox.com/asset/?id=1234'

Discussion

Below are the steps:

  1. Create a new ImageLabel whose Image property is set to an asset ID.
  2. To get this asset ID goto the Insert panel (under Insert --> Roblox Insert Panel).
  3. Click “My Decals” or “Free Decals” and pick out an image
  4. Click the image you want and look at the Properties inspector. You’ll see a Texture property.
  5. Copy the value of the Texture property and that is your image asset ID.
Tags:
  • gui
  • image
  • script