Jump to content

GUI Not Closing [HELP]


toptional

Recommended Posts

Hey, I made this GUI, and i have tried loads of code its failing so much. I need the GUI to SHOW When i press F5 That just wont happen take a look

Window = {} 
Button = {} 
Memo = {} 
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
function ( ) 
Main_Window = guiCreateWindow(251,243,533,256,"CMG Team Changer",false) 
Memo_Info = guiCreateMemo(53,45,429,102,"With this script you can now change team, to stop Abuse we have made it cost 50k per team Change!\n\nCOSTS 50k!!! ",false,Main_Window) 
Button_LS = guiCreateButton(58,171,115,58,"Change to LS",false,Main_Window) 
Button_LV = guiCreateButton(219,171,115,58,"Change to LV",false,Main_Window) 
Button_SF = guiCreateButton(383,171,115,58,"Change to SF",false,Main_Window) 
Button_Close = guiCreateButton(479,21,40,24,"Close",false,Main_Window) 
end 
) 
  
  
guiWindowSetSizable(Main_Window, true) 
guiSetVisible(Main_Window, true) 
function Main_WindowFunction (keyPresser) 
    if guiGetVisible(Main_Window) then 
        guiSetVisible(Main_Window, false) 
        showCursor(false, false) 
    else 
        guiSetVisible(Main_Window, true) 
        showCursor(true, true) 
    end 
end 
bindKey("f5", "down", Main_Window) 
  

Ty Guys

Link to comment
Hey, I made this GUI, and i have tried loads of code its failing so much. I need the GUI to SHOW When i press F5 That just wont happen take a look
Window = {} 
Button = {} 
Memo = {} 
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
function ( ) 
Main_Window = guiCreateWindow(251,243,533,256,"CMG Team Changer",false) 
Memo_Info = guiCreateMemo(53,45,429,102,"With this script you can now change team, to stop Abuse we have made it cost 50k per team Change!\n\nCOSTS 50k!!! ",false,Main_Window) 
Button_LS = guiCreateButton(58,171,115,58,"Change to LS",false,Main_Window) 
Button_LV = guiCreateButton(219,171,115,58,"Change to LV",false,Main_Window) 
Button_SF = guiCreateButton(383,171,115,58,"Change to SF",false,Main_Window) 
Button_Close = guiCreateButton(479,21,40,24,"Close",false,Main_Window) 
end 
) 
  
  
guiWindowSetSizable(Main_Window, true) 
guiSetVisible(Main_Window, true) 
function Main_WindowFunction (keyPresser) 
    if guiGetVisible(Main_Window) then 
        guiSetVisible(Main_Window, false) 
        showCursor(false, false) 
    else 
        guiSetVisible(Main_Window, true) 
        showCursor(true, true) 
    end 
end 
bindKey("f5", "down", Main_Window) 
  

Ty Guys

problem is that u made the bindKey function same as the window name. Try:

addEventHandler ( "onClientResourceStart", resourceRoot, 
function ( ) 
local Main_Window = guiCreateWindow(251,243,533,256,"CMG Team Changer",false) 
local Memo_Info = guiCreateMemo(53,45,429,102,"With this script you can now change team, to stop Abuse we have made it cost 50k per team Change!\n\nCOSTS 50k!!! ",false,Main_Window) 
local Button_LS = guiCreateButton(58,171,115,58,"Change to LS",false,Main_Window) 
local Button_LV = guiCreateButton(219,171,115,58,"Change to LV",false,Main_Window) 
local Button_SF = guiCreateButton(383,171,115,58,"Change to SF",false,Main_Window) 
local Button_Close = guiCreateButton(479,21,40,24,"Close",false,Main_Window) 
  
  
guiWindowSetSizable(Main_Window, false) 
guiSetVisible(Main_Window, false) 
function Main_WindowFunction(keyPresser) 
    if ( guiGetVisible(Main_Window) == false ) then 
        guiSetVisible(Main_Window, true) 
        showCursor(true) 
    elseif ( guiGetVisible(Main_Window) == true ) then 
        guiSetVisible(Main_Window, false) 
        showCursor(false) 
    end 
end 
bindKey("f5", "down", Main_WindowFunction) 
  
end 
) 
  

EDIT: Copy code again.

Edited by Guest
Link to comment

1) You bind a key to F5 to call nil (not a value at all)

2) You use guiWindowSetSizable and guiSetVisible and use nil as a first parameter.

3) Main_WindowFunction is never called.

Try not to execute any code outside functions. Do it in on(Client)ResourceStart instead if you want it to be executed at start.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...