• Lua error with F4 Menu
    6 replies, posted
So im making an F4 Menu and i've run into a problem. The F4 Menu will not open. Instead it gives off this lua error Warning: vgui.Create failed to create the VGUI component (cs_f4_menu) [ERROR] addons/exodusf4/lua/autorun/customf4.lua:21: attempt to index global 'CSF4Menu' (a nil value) 1. func - addons/exodusf4/lua/autorun/customf4.lua:21 2. unknown - lua/includes/extensions/net.lua:32 The code thats in the file is: if SERVER then AddCSLuaFile( "vgui/cs_f4_menu.lua" ) util.AddNetworkString("f4menu") hook.Add( "ShowSpare2", "F4MenuHook", function( ply ) net.Start( "f4menu" ) net.Send ( ply ) end) end if CLIENT then include( "vgui/cs_f4_menu.lua" ) net.Receive( "f4menu", function() if( !CSF4Menu ) then CSF4Menu = vgui.Create( "cs_f4_menu" ) CSF4Menu:SetVisible ( false ) end if( CSF4Menu:IsVisible() ) then CSF4Menu:SetVisible( false ) gui.EnableScreenClicker( false ) else CSF4Menu:SetVisible( true ) gui.EnableScreenClicker( true ) end end) end
CSF4Menu:SetVisible ( false ) CSF4Menu:SetVisible( false )
Warning: vgui.Create failed to create the VGUI component (cs_f4_menu) [ERROR] addons/exodusf4/lua/autorun/customf4.lua:21: attempt to index global 'CSF4Menu' (a nil value)   1. func - addons/exodusf4/lua/autorun/customf4.lua:21    2. unknown - lua/includes/extensions/net.lua:32
Have you registered a vgui element called cs_f4_menu?
I've got this     vgui.Register( string cs_f4_menu, table panelTable, string CSF4Menu )
It's that your actual code? That's not valid and you should be getting errors.
vgui.Register( "cs_f4_menu", PANEL) timer.Simple( 2, function() GAMEMODE.ShowSpare2 = openF4 end ) concommand.Add("open_f4", function() openF4() end)
Sorry, you need to Log In to post a reply to this thread.