Swep opens up dialog box?

I want to make a swep but I need a string from the swep user. I want that:

  1. When the user presses mouse3 a dialog box will appear with a message and below a small box where he can enter a string of whatever lenght

  2. I need to know how to then get the string

  3. The string needs to be retained if the weapon gets holstered (or dropped etc.) (doesnt need to be retained when the server gets restarted)

  4. If possible without a server side command (only if possible tho)

I am still quite bad so if you guys could help me out a little that would be nice. I already looked at some tutorials for guis but either they are outdated or dont really work with a swep.

Im sorry if this question is stupid. I am really trying but I just started really.


input.WasMousePressed http://wiki.garrysmod.com/page/Category:DTextEntry


  1. Store the string as a weapon variable (ex. pWeapon.m_sUserInput = pTextEntry:GetValue())

  2. Can be done completely clientside

Can you post an example code? I know this is old but I need this now and I cant get it to work.

Just make it so it opens when the player hits reload. Please?

Btw. Could it be that everything in the shared.lua is always serverside? Cause calling vgui in there always is undefined

If you need someone to make you anything then your best bet would be to post here as we generally don’t spoon feed. However, if you’re willing to learn then you can post your attempts here and we’ll try to help.