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

Why is my ImageLabel isn't showing my player image?

I am trying to make my imagelabel to be able to display my player's image. I run the game and it gives me an error saying that the trust check has failed. The imagelabel doesn't display the player image at all. This is all done on a billboard GUI element. I think you will understand the problem better if I just paste my code.

local Brick = script.Parent.Parent.Parent
local Picture = script.Parent.UserImage
local User = script.Parent.Username

Brick.Touched:connect(function(Object)
	local Character = Object.Parent:FindFirstChild("Humanoid")
	if Character ~= nil then --Make sure the character is a character or an NPC
		local Player = game:GetService("Players"):GetPlayerFromCharacter(Object.Parent)
		if Player ~= nil then --This should be narrowed down to a player instead of an NPC
			Picture.Image = "http"..Player.Name
			User.Text = Player.Name
		end
	end
end)

1 comment

0

Did you even TRY to put any effort into that?

1 answer

The way you did it is incorrect. The link is not valid, it will spew something unexpected or error. Looking in the https://github.com/matthewdean/roblox-web-apis(credit for links goes to matthewdean), it looks like this could work, toggle through the thumbnail api's to see if one could actually work. Another place is http://wiki.roblox.com/index.php?title=Web_APIs#Asset_thumbnail

local Brick = script.Parent.Parent.Parent
local Picture = script.Parent.UserImage
local User = script.Parent.Username

Brick.Touched:connect(function(Object)
    local Character = Object.Parent:FindFirstChild("Humanoid")
    if Character ~= nil then --Make sure the character is a character or an NPC
        local Player = game:GetService("Players"):GetPlayerFromCharacter(Object.Parent)
        if Player ~= nil then --This should be narrowed down to a player instead of an NPC
            Picture.Image = string.format("http://www.roblox.com/Thumbs/Avatar.ashx?x=%d&y=%d&username=ROBLOX", 100, 100, Player.Name)
            User.Text = Player.Name
        end
    end
end)

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