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

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

Asked by 5 years ago

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.

0
gui is the gui in PlayerGui EatableDragonkight 3 — 5y
0
it has to be a variable otherwise it will be read as nil DeceptiveCaster 3761 — 5y
0
if that doesn't work try editing the gui from inside the PlayerGui DeceptiveCaster 3761 — 5y
0
could you provide the full code? might help GoldAngelInDisguise 297 — 5y
View all comments (2 more)
0
and what do you mean by "gui" do you mean ScreenGui? GoldAngelInDisguise 297 — 5y
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. User#20279 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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
0
Also add an end) to the script User#25920 0 — 5y
Ad

Answer this question