I Am Trying To Make A Custom F4 Menu And I'm New To Lua So I'm Using A Tutorial
https://www.youtube.com/watch?v=t45yKnLPOog
But When I Press F4 Nothing Happens And I Need Help.
if SERVER then
util.AddNetworkString( "f4menu" )
function F4MenuFunc( ply )
net.Start( "f4menu" )
net.Send( ply)
end
hook.Add( "ShowSpare2", "F4MenuHook", F4MenuFunc )
end
if CLIENT then
net.receive( "f4menu", function()
if( !frame ) then
local frame = vgui.create( "DFrame" )
frame:setsize( 1000,720 )
frame:center()
frame:setvisible( true )
frame:MakePopup()
frame:SetDeleteOnClose( true )
end
end
end
on your net.Receive function (it's not capitalized by the way) but you never end the parentheses after the end for that function.
So Like This
if SERVER then
util.AddNetworkString( "f4menu" )
function F4MenuFunc( ply )
net.Start( "f4menu" )
net.Send( ply)
end
hook.Add( "ShowSpare2", "F4MenuHook", F4MenuFunc )
end
if CLIENT then
net.Receive( "f4menu") , function()
if( !frame ) then
local frame = vgui.create( "DFrame" )
frame:setsize( 1000,720 )
frame:center()
frame:setvisible( true )
frame:MakePopup()
frame:SetDeleteOnClose( true )
end
end
end
You aren't including the function within the net.Receive call.
if CLIENT then
--
net.Receive( "f4menu" , function()
if( !frame ) then
local frame = vgui.create( "DFrame" )
frame:setsize( 1000,720 )
frame:center()
frame:setvisible( true )
frame:MakePopup()
frame:SetDeleteOnClose( true )
end
end ) -- this should be here
end
your code in the client is not good, let's give me help you
if ( CLIENT ) then
net.Receive( "f4menu" , function()
if( !frame ) then
local frame = vgui.create( "DFrame" )
frame:setsize( 1000,720 )
frame:center()
frame:setvisible( true )
frame:MakePopup()
frame:SetDeleteOnClose( true )
end
end)
end
you are forgot to close the parentheses of the function.
now the code it's going to work.
Thanks For The Help But Neither of these work
Sorry, you need to Log In to post a reply to this thread.