ID:139791
 
Code:

obj/Hud
Skilltreebutton
icon = 'Pack.dmi'
icon_state="T"
layer = MOB_LAYER+900000
screen_loc="4,1"
Click()
usr.SkillTree()

mob/verb
closeHud()
src.client.screen-=new/obj/Hud/Skilltreebutton
mob/verb
OpenHud()
src.client.screen+=new/obj/Hud/Skilltreebutton



Problem description:I Need it so when the Interface Button Is Clicked it will Hit Closehud And Close the Hud but i trying with verb to make it work but when hit close hud it wont take it off the screen

That's because the object you are removing from the screen is not the same object that you added to it. It's the same type, but not the same object. You need to keep track of the specific object you've created and added if you want to be able to remove it later.

Also, adding gigantic values to something's layer can cause undesired results. Stick to reasonable values. You can use decimal values (like 2.5) if needed.
In response to Garthor
Garthor wrote:
That's because the object you are removing from the screen is not the same object that you added to it.


what u mean there both the

obj/Hud
Skilltreebutton
icon = 'Pack.dmi'
icon_state="T"
layer = MOB_LAYER+900000
screen_loc="4,1"
Click()
usr.SkillTree()
its set to? im kinda confused
In response to Jub369
You are creating an object. Call it Bob, because it has the name "Bob".

You are adding Bob to a client's screen. Now, the client's screen list contains one object: Bob.

Now, you want to remove Bob from the client's screen. To do so, you are creating another object, whose name is also Bob but we will call "NotBob", because it's not Bob. You are then attempting to remove NotBob from the client's screen list. However, the client's screen list does not contain NotBob. Therefore, removing NotBob from it does nothing.

You instead need to have a variable, call it VariableThatHoldsBob, and when you create Bob, set that variable to Bob. Then, when you want to remove Bob, remove VariableThatHoldsBob (which holds Bob) from the client's screen list.
In response to Garthor
ok you had me till you said the thing about add a var for Bob so we say it.