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

How do I correctly get a character's appearance into an ImageLabel?

Asked by 9 years ago

I have a script that shows a player's CharacterAppearance that repeats every second. Here's the script (the script is inside an ImageLabel):

local plr = game.Players.LocalPlayer
repeat wait() until plr

while wait(1) do
    script.Parent.Image = plr.CharacterAppearance
end

The problem is that the picture of the character doesn't show up. The output says:

"...Failed to resolve texture format"

So, how do I correctly get a character's appearance into an ImageLabel?

2 answers

Log in to vote
4
Answered by
Diitto 230 Moderation Voter
9 years ago

Well, you're using the wrong string. You can use

http://www.roblox.com/Thumbs/Avatar.ashx?username=whyOmustOitObeOme

or

http://www.roblox.com/Thumbs/Avatar.ashx?userid=4330521

Those are the official links for character appearance. In my script, I do: CharImage='http://www.roblox.com/thumbs/avatar.ashx?x=352&y=352&format=png&username=%s';, which enables me to format pictures for players.

To fully fix your script:

local Player = game:service('Players').LocalPlayer
local characterImageFormat='http://www.roblox.com/Thumbs/Avatar.ashx?x=352&y=352&format=png&userid=%d';

-- repeat wait() until plr --// No point. :(

while wait(1) do
    script.Parent.Image = characterImageFormat:format(Player.userId);
end
0
Do you mind putting that into the script I wrote for me? Also, it can't be just one player. It has to work for every player to enter the game. whyOmustOitObeOme 7 — 9y
0
Sure. Editing my answer right now. Diitto 230 — 9y
0
Sweet, it worked! I have no idea how it works, though. whyOmustOitObeOme 7 — 9y
0
The reason that it works is that the ROBLOX character appearance image format is the /Thumbs/Avatar link. Diitto 230 — 9y
View all comments (2 more)
1
Can I suggest not using Usernames and using IDs, because usernames can be changed and IDs can't. Mystdar 352 — 9y
0
@Myst, that's why I posted the link for userId as well. Diitto 230 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

Sorry, but I don't think you can. A character's appearance isn't even a file. If it was, it would be an obj. file most likely. I see what you're trying to do. Here's my best shot:

script.Parent.Image = "http://www.roblox.com/thumbs/avatar.ashx?x=352&y=352&format=png&username="..plyr.Name
1
Btw, the character appearance is the full 3D model, not just the avatar picture. TheDeadlyPanther 2460 — 9y
0
It's not an .obj file, it's an XML file. :P Diitto 230 — 9y
1
Doesn't matter, really. You get the idea... TheDeadlyPanther 2460 — 9y
0
I know, I was just pointing that out.. Diitto 230 — 9y
View all comments (2 more)
1
Damn, I was hoping I was gonna be the only answerer... And then Ditto did his and I gave it a point (It was correct, after all).. Then whyO saw his first... *sigh* I help others and get nothing. TheDeadlyPanther 2460 — 9y
0
Thumbs up'd. Also, IT'S DIITTO. D I I T T O. I swear, the next person who says "Ditto" is going to get DoS'd. Diitto 230 — 9y

Answer this question