[lua\includes\modules\usermessage.lua:77] attempt to call field 'Function' (a nil value)

Anyone know whats wrong with the module thats stopping my menu from working?

cl_init


function OpenF1MenuFunc()
Msg( "Menu Worked" )
end

usermessage.Hook( "OM11Hook", OpenF1MenuFunc );

init.lua


function GM:ShowTeam( ply )
    umsg.Start( "OM11Hook", ply )
    umsg.End()
end

I am deriving from sandbox, do i have to stop sandbox from calling something before calling my own function?

[lua]
if SERVER then
hook.Add(“ShowTeam”,“lolololol”,function( ply )
umsg.Start( “OM11Hook”, ply )
umsg.End()
end)
elseif CLIENT then
usermessage.Hook( “OM11Hook”, function()
Msg( “Menu Worked” )
end)
end
[/lua]

Worked.

Hmmmmmm.

I really don’t have a clue what the problem is, I’ll try it without the second function.

Post full code please.

The full code is just a derma menu.

The derma menu works outside the gamemode.

You should always look in the file the error is coming from:smile:

Seems that ‘OpenF1MenuFunc’ is nil when you pass it to usermessage.Hook for some reason.

Thank you for this.

Is there any possible things I could do to fix this?

You can’t ‘fix it’ more than you can ‘fix’ not taking on your shoes before going outside, you just gotta take them on, or in your case set the variable to something.
If you post your actual code instead of similiar code I, and others, might be able to spot where the problem lies.