Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How many pixels x pixels should a image be if it is set to fit whole screen in an ImageLabel?

How many pixels x pixels should a image be i fit is set to fit whole screen in an ImageLabel?

I know this question is not really about scripting, but I need to know how many pixels x pixels a image should be if it is set to fit whole screen in ImageLabel because I will use it as a background for a GUI that I am scripting.

I have tried many times, but somehow, when I put the image into the ImageLabel that fills the whole screen, it zooms to the top left corner of the image.

I have also tried messing with the properties of the imagelabel, and nothing seems to work!

Any help is greatly appreciated!

1 comment

0

you would use scael

1 answer

✓ Accepted answer

UDim2 (which is the data type used to position and size GUI's) consists of two UDim values. The UDim data type holds two integers, a scale and an offset.


####Taken from the wiki: Scale is a number between 0.0 and 1.0 that is a percentage of the parent object's size. For example, if the parent object is 50 pixels wide, a UDim scale of 0.5 would be 25 pixels wide. 0.5 makes the size cover 50% of it's parent, same as 0.38 is going to cover 38%, 0.85 is going to cover 85%, and so on.

Offset is a specified Integer. This is a non changing value that is factored into the UDim calculation.


For your problem, you want the Image to be scaled to fit the screen. Therefore, if you parent it to a ScreenGui and set the X and Y scales of the UDim2 to 1, then it will be scaled to be the same size as the dimensions of the window.

Assuming 'imageLabel' and 'screenGui' are defined:

imageLabel.Size = UDim2.new(1, 0, 1, 0)
imageLabel.Parent = screenGui

This discussion is preserved as it was. New answers, comments, and votes are closed.