How can I make an NPC open a user interface??

How can I make an NPC open a user interface?? So it can sell something to the player. Any help would be appreciated

Thanks,

Send a net message from your bot to the player, and on receiving the net message, open your interface.

Sorry a little new to coding! Minding giving a little more detail? (:

No problem, you’re welcome, when begin developing I was 10 years old and I began from nothing, so here you go : basicaly you want to send a net message when the player uses your NPC. The first thing you need to know is that Robotboy has made something realy bad to SNPCs : they are no longer moddable client side you can only mod them server side, so a base class for your SNPC will then be impossible.
However as a workaround I suggest you to recode yourself the complete NPC animation behaviour on a non NPC entity, but a basic scripted entity (SENT). I already done that on my own GameMode.

But if you still want to use SNPC, then here are start code :



//Main init.lua file for your SNPC
function ENT:Init()
     //Do init stuff here
end
util.AddNetworkString("NetString")
function ENT:AcceptInput(input, act, call, data)
     if (input == "use" && IsValid(act) && act:IsPlayer()) then
          net.Start("NetString")
          net.Send(act)
     end
end

//Now on a client lua file do
net.Receive("NetString", function(len, ply)
      local frame = vgui.Create("RRP_DFrame") //Use DFrame if you've not any custom DFrame
      frame:SetSize(128, 128)
      frame:SetPos(ScrW() / 2 - 64, ScrH() / 2 - 64)
      local b = vgui.Create("DButton", frame)
      b:SetPos(5, 5)
      b:SetSize(118, 118)
      b.DoClick = function()
           print("Hello World ! My Button Has Been Clicked")
           LocalPlayer:ConCommand("disconnect") //Example disconnect the player from the current server
      end
end)


I hope this helps you !