Help with an error on a warning addon.

When i start up my server i get these errors and i cant see where i messed up at. Can someone please help.


[ERROR] addons/warning/lua/autorun/sh_warning.lua:29: 'end' expected (to close '
function' at line 1) near '<eof>'
  1. unknown - addons/warning/lua/autorun/sh_warning.lua:0


[ERROR] addons/warning/lua/autorun/sh_warning.lua:1: unexpected symbol near 'the
n'
  1. unknown - addons/warning/lua/autorun/sh_warning.lua:0


[ERROR] addons/warning/lua/autorun/sh_warning.lua:29: 'end' expected (to close '
function' at line 1) near '<eof>'
  1. unknown - addons/warning/lua/autorun/sh_warning.lua:0



Coding of the addon


local function ChatGUI(ply, text)
	if string.sub(text, 1, 9) == "/warnings" then
		if ply != LocalPlayer() then return true end
hook.Add("OnPlayerChat", "ChatGUI", ChatGUI)
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50, 50 )
DermaPanel:SetSize( 300, 325 )
DermaPanel:SetTitle( "Testing Derma Stuff" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
local TestingPanel = vgui.Create( "DPanel", DermaPanel )
TestingPanel:SetPos( 25, 50 )
TestingPanel:SetSize( 250, 250 )
TestingPanel.Paint = function() -- Paint function
    --Set our rect color below us; we do this so you can see items added to this panel
    surface.SetDrawColor( 50, 50, 50, 255 ) 
    surface.DrawRect( 0, 0, TestingPanel:GetWide(), TestingPanel:GetTall() ) -- Draw the rect
end
 
local DermaButton = vgui.Create( "DButton", TestingPanel )
DermaButton:SetText( "Testing~Should kill" )
DermaButton:SetPos( 20, 10 )
DermaButton:SetSize( 200, 100 )
DermaButton.DoClick = function ()
    RunConsoleCommand( "kill" )
	end
end

Replace first 4 lines with:



hook.Add("OnPlayerChat", "ChatGUI", function(ply, text)
    if string.sub(text, 1, 9) == "/warnings" then
        if ply != LocalPlayer() then return true end
    end
end )

you can’t have the ) on line three at the end

Whoops, my bad, failed copy-paste, thanks.