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

Whenever i set the image for an imagelabel it doesn't load?

I am trying to make a script that shows the current avatar of the player, but everytime i try to set the image for the imagelabel, it doesn't load at all.

This is the code i am using to set the image:

local frame = Instance.new("ImageLabel",gui)
local player = game.Players.LocalPlayer
frame.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=150&Format=Png&username="..player.Name

The code is inside a LocalScript inside a gui.

Is there anything i'm missing? Any help is appreciated, thank you.

6 comments

0

gui is the gui in PlayerGui

0

it has to be a variable otherwise it will be read as nil

0

if that doesn't work try editing the gui from inside the PlayerGui

0

could you provide the full code? might help

0

and what do you mean by "gui" do you mean ScreenGui?

0

Try removing the “&Format=Png” part. I looked through Roblox’s web APIs and none of them have that. If that still doesn’t work, try changing both 150s to 100 and keep the “&Format=Png” part removed.

1 answer

The reason you are having trouble is that you defined the frame as an image, not as an image frame. Here is the correct code.


local image = Instance.new.ImageLabel

image.AbsolutePosition.OffSet = {5,5}{1,0}
image.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=150&Format=Png&username="..player.Name

1 comment

0

Also add an end) to the script

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