How to get this?

How would it be possible to print something if they click on the AvatarImage, Like if they click it , it will print, “Hello world”, just for example


(User was banned for this post ("utt" - garry))

Avatar.DoClick = function()
–Do stuff
end

Ive tried that, and it wont work /…

Show us what you’ve tried.

[LUA] local localplayer = LocalPlayer();
if not localplayer then
if wAv and wAv:IsValid() then
wAv:Remove();
end
if wAv2 and wAv2:IsValid() then
wAv2:Remove();
end
return
end
if not wAv2 or not wAv2:IsValid() then
wAv2 = vgui.Create(“DPanel”)
wAv2:SetSize( 128, 128)
wAv2:SetPos(ScrW() - 1365, ScrH() - 130)
end
if not wAv or not wAv:IsValid() then
wAv = vgui.Create(“AvatarImage”, wAv2)
wAv:SetSize( 128,128 )
wAv:Center()
wAv:SetPlayer(LocalPlayer(), 64 )
wAv.DoClick = function() MsgN(" TEst") end
AvatarShouldDraw = 0
end
[/LUA]

IsValid is for entities.

Try this:
[LUA] local localplayer = LocalPlayer();
if not localplayer then
if ValidPanel(wAv) then
wAv:Remove();
end
if ValidPanel(wAv2) then
wAv2:Remove();
end
return
end
if not ValidPanel(wAv2) then
wAv2 = vgui.Create(“DPanel”)
wAv2:SetSize( 128, 128)
wAv2:SetPos(ScrW() - 1365, ScrH() - 130)
end
if not ValidPanel(wAv) then
wAv = vgui.Create(“AvatarImage”, wAv2)
wAv:SetSize( 128,128 )
wAv:Center()
wAv:SetPlayer(LocalPlayer(), 64 )
wAv.DoClick = function() MsgN(" TEst") end
AvatarShouldDraw = 0
end
[/LUA]

ValidPanel() Does exactly what you were trying to do.