Need help with autorun script

Why doesn’t this work? I don’t get any errors. It just says motd is a nil command. I put it in autorun/client.




local function Motd( ply )
   MOTD = vgui.Create( "DFrame" )
   MOTD:SetPos( 0,0 )
   MOTD:SetSize( ScrW(), ScrH() )
   MOTD:SetTitle( "Message of the Day" )
   MOTD:SetVisible( true )
   MOTD:SetDraggable( false )
   MOTD:ShowCloseButton( true )
   MOTD:MakePopup()
end

concommand.Add( "motd", Motd )



Here this should work

[lua]local motd = vgui.Create( “Dframe” )
motd:SetPos( 0,0 )
motd:SetSize( ScrW(), ScrH() )
motd:SetTitle( “Message of the Day” )
motd:SetVisible( true )
motd:SetDraggable( false )
motd:ShowCloseButton( true )
motd:MakePopup()
end

concommand.Add( “motd”, motd )[/lua]

…No?

I’ve had some problems with autorun/client scrips not running. You can try solving this one of two ways:

  1. Use AddCSLuaFile in a serverside function.

  2. In game, use this console command:
    lua_openscript_cl autorun/client/<script name>.lua

[lua]
if ( SERVER ) then
AddCSLuaFile(“autorun/motd.lua”)
else
include(“autorun/motd.lua”)

local function Motd( ply )
MOTD = vgui.Create( “DFrame” )
MOTD:SetPos( 0,0 )
MOTD:SetSize( ScrW(), ScrH() )
MOTD:SetTitle( “Message of the Day” )
MOTD:SetVisible( true )
MOTD:SetDraggable( false )
MOTD:ShowCloseButton( true )
MOTD:MakePopup()
end
concommand.Add( “motd”, Motd )
end
[/lua]

Oh I see…

Thanks.