Hey, im not so good at LUA so i asked my brother who is okay at LUA and searched around for abit but have failed to find a solution. Im out of ideas so i hate to ask but does anyone know how i could fix this:
The Error:
[ERROR] gamemodes/example/gamemode/cl_init.lua:6: attempt to index global 'vgui' (a nil value)
1. unknown - gamemodes/example/gamemode/cl_init.lua:6
2. unknown - lua/includes/modules/concommand.lua:69
How error occures: When typing: Open_coolMenu into console
The Code [ located in cl_init.lua ]:
function CreateF4Menu()
local base = vgui.Create( 'DFrame' )
base:SetName("HelloWorldFrame")
base:SetSize( 600,300 )
base:Center()
base:ShowCloseButton( true )
base:SetDraggable( false )
base:MakePopup()
end
concommand.Add( 'Open_coolMenu', CreateF4Menu )
Please help, thanks.
You're running the file serverside.
[QUOTE=EvacX;43851565]You're running the file serverside.[/QUOTE]
AddCSLuaFile("cl_init.lua") <- located in init.lua
Are you [I]including[/I] it in init.lua or another file (eg. shared.lua) by accident?
[QUOTE=Bo98;43851745]Are you [I]including[/I] it in init.lua or another file (eg. shared.lua) by accident?[/QUOTE]
I only have it included in the init.lua
Is it suppose to be there?
You should not include the client-side files in init, otherwise they will be run server-side
-snip-
[QUOTE=Monkey471;43851820]I only have it included in the init.lua
Is it suppose to be there?[/QUOTE]
You don't include cl_init.lua or init.lua for gamemodes. They are automatically included where needed.
Solved: I accidently included the cl_init.lua ... thanks guys!
Sorry, you need to Log In to post a reply to this thread.