Lua MOTD error

EDIT: Completely new to Facepunch posting… I need this thread moved to the Modding category :S Sorry!!

Hi guys and girls.

I’ve been having issues with some code that was released by a community member of Facepunch; Bandit Kitteh, it was originally designed for a website URL but I’ve ‘attempted’ to get it working for HTML.

The code is below;

if CLIENT then
        local Frame = vgui.Create("DFrame")
        Frame:SetSize(ScrW() - 20, ScrH() - 20)
        Frame:SetTitle("Sasso's District Server Rules")
        local html = vgui.Create("DHTML", Frame)
        html:SetSize(ScrW() - 30, ScrH() - 30)
        html:SetHTML( file.Read( "data/sassomotd.txt" ) )
if SERVER then
    hook.Add("PlayerSay", "ChatHook", function(Player, Text, Public)
        if Text[1] == "!" then
            Text = Text:lower()
            if Text == "!motd" then
                return ""

hook.Add("PlayerInitialSpawn", "OpenMotd", function(ply)

The error I get from my servers console is this;

[ERROR] lua/autorun/motd.lua:13: bad argument #1 to 'SetHTML' (string expected, got no value)
  1. SetHTML - [C]:-1
   2. unknown - lua/autorun/motd.lua:13
    3. unknown - lua/includes/modules/concommand.lua:69

I have no knowledge of LUA coding but attempted to adapt and learn… Failed miserably! What do I need to do to get this working?

Side note: I’m after an independent MOTD, one that is not apart of an admin mod such as ULX. Hence why I am attempting to get this working.


Does that file exist? Try setting it to a variable first, then printing the variable.

The file exists but, I am unsure how to set variables and such… Can you help?

What is in that file?

By file, I assume you mean the motd in data?

<body bgcolor=#000000>

<center><u><h1 style="text-align: center"><font color=#FF0000>Sasso's District</h1></center></u></font>
<center><font color="#FFFFFF">Server Addons: Wire, Armored Combat Framework, M9K and SProps.</font></p></center>
<p style="text-align: center">

<p style="text-align: center">
<font size="4" color="#FF0000">DO NOT ASK FOR PROMOTIONS.</font></p>
<p style="text-align: center">
<font size="2" color="#FF0000">If we feel you have earned it, you will get it.</font><font color="#FFFFFF"><br>
<h2 style="text-align: center">The District Rules</h2>
</font><font color="#00FFFF">
<p style="text-align: center"</font><font color="#FF0000">PAY ATTENTION TO THEM OR WE TAKE ACTION!</font><font color="#00FFFF"</p>
</font><font color="#FFFFFF">
    <li>Obey and Respect all District Admins. Even if you feel that it is unlawful, do not argue.</li>
    <li>Do not spam props or tools. First spam is a kick, second is time ban, 
    third is permaban.</li>
    <li>No prop pushing. (Using a prop to mess with other players)</li>
<li>Deathmatching is allowed here, but you must not be in noclip and the 'victim' must agree to deathmatching.</li>
<li>You may ask for God mode if you wish to just build. If you kill in god mode, it will be taken from you.</li>
    <li>Racism, Sexist, or otherwise words or actions that is looked down upon 
    by humanity will not be tolerated.</li>
    <li>Asking for help more then three times is considered an annoyance and 
    you will be gimped/gagged.</li>
    <li>Don't mess with other players and their props unless they ask for assistance.</li>
    <li>Stay off voice chat if you have loud noise in the background, or if your microphone is too loud.</li>
<p> </p>
<p style="text-align: center">Mingebags will NOT be treated with respect. They will be 
treated in turn, with Administrative Actions.</p>
<div style="width: 100%; text-align: center; margin: 10px; font-weight: bold;">- 
    <font face="ParkAvenue BT" size="5"><i>The District Admins</i></font></font><p>
    <span style="font-weight: 400"><i>
    <font face="Arial Unicode MS" size="1" color="#FF0000">MOTD Created by 
    The District Owner - Sasso.</font></i></span></div>