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

Why is my Player Image Billboard Gui not working?

Asked by 8 years ago
Edited 8 years ago

I'm trying to make a billboard gui so when you walk up to it it shows your player image but it wont work here is my code local Brick = script.Parent.Parent.Parent

local Picture = script.Parent.UserImage

local User = script.Parent.Usename

function onTouch(Object)

local Character = Object.Parent.findFirstChild("Humanoid")

if(Character ~= nil)then
    local player = game.Players:GetPlayerFromCharacter(Object.Parent)

    if(Player ~= nil)then

        Player.Image = "http" .. Player.Name
        User.Text = Player.Name

    end
end

end

script.Parent.Touched:connect(OnTouch)

1 answer

Log in to vote
0
Answered by 8 years ago

Try this, haven't tested it so not sure if it works 100% like it should.

local Brick = script.Parent
local Picture = script.Parent.BillboardGui:WaitForChild('UserImage')
local User = script.Parent.BillboardGui:WaitForChild('UserName')
function onTouch(Object)
    local Character = Object.Parent:FindFirstChild("Humanoid")
    if(Character ~= nil)then
        local player = game.Players:GetPlayerFromCharacter(Object.Parent)
        if(player ~= nil)then 
            Picture.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username=" .. player.Name
            User.Text = player.Name
        end

    end

end
script.Parent.Touched:connect(onTouch)
Ad

Answer this question