I am trying create a function that will create an ImageLabel. Within this function, i would like to pass a parameter that alters the size of my label.
local function CreateImageLabel(parent,name,image,size)
local imagelabel = Instance.new('ImageLabel',parent)
imagelabel.Size = UDim2.new(size)
imagelabel.Image = image
return imagelabel
end
i would like to call this function like so:
`` imagelabel = CreateImageLabel(parent,'label','rbx.whatever', (1,0,1,0))
My function will not work. Would i have to change it to:
local function CreateImageLabel(parent,name,image,x,y)
local imagelabel = Instance.new('ImageLabel',parent)
imagelabel.Size = UDim2.new(x,0,y,0)
imagelabel.Image = image
return imagelabel
end
or is there a clean way to achieve what im trying to do?

1 comment
This answers exactly what i needed to know. Thank you. I am learning roblox's lua, and lua in general. Thanks a ton!