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

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

Asked by 7 years ago

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)
0
Did you even TRY to put any effort into that? itsJooJoo 195 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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)

Ad

Answer this question