Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Instancing image not working ?

Asked by
Bulvyte 388 Moderation Voter
7 years ago
Edited 7 years ago

Just.. Instancing doesn't work ? i know im writing something wrong for the image what is it ??

TextLabel2 = Instance.new("TextLabel", GUI)
ImageLabel2 = Instance.new("ImageLabel", GUI, TextLabel2)
ImageLabel2.Image = "http://roblox.com/asset/?id=156071939"

i try looking the wiki it says image thats all i get i don't know how to write it pls help :/

2 answers

Log in to vote
2
Answered by 7 years ago
Edited 7 years ago
  • Instance.new

    • You should remove TextLabel2 from the second line, because Instance.new does not have a 3rd argument.
  • Image

    • There is no 'new' after image. You're not creating a an object from a class or anything, you're just setting a value to a property.

This should be your revised code:

TextLabel2 = Instance.new("TextLabel", GUI)
ImageLabel2 = Instance.new("ImageLabel", TextLabel2)
ImageLabel2.Image = "http://roblox.com/asset/?id=156071939"
0
then how do i instance it into the textlabel ? Bulvyte 388 — 7y
0
You set the parent of the object in the second argument of the function, or you can manually set it with the 'Parent' property. In this case, it's already set for you. ScriptGuider 5640 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

To make this work AND be instanced into the TextLabel, you need to set the parent for ImageLabel2, by doing ImageLabel2.Parent = TextLabel2

TextLabel2 = Instance.new("TextLabel", GUI)
ImageLabel2 = Instance.new("ImageLabel", GUI)
ImageLabel2.Parent = TextLabel2
ImageLabel2.Image = "http://roblox.com/asset/?id=156071939"

Answer this question