Lua noob looking for advice/help

Hello, I’ve been messing around with Lua and tried to make some kind of config using these “variables”
Anyway… the variables won’t “apply” when I “call them”… for example in the player join message, it worked just fine few days ago and now it’s not. Back then they were separate files.
the file is shared file and is placed in lua/autorun as a “shared” file. I know some of them won’t probably work, but I’m just learning.
Am I doing something stupid wrong? any help is appreciated!

There is no errors displayed.


--[[ CONFIG FILE --]]

--[[ join message --]]
joinmessagesadmin = true -- true/false
joinmessageadmintext = " the admin has joined the game." -- text that pops up when admin joins the game, if enabled

joinmessageposition = HUD_PRINTTALK -- where does the text on usermessages appear? HUD_PRINTTALK is on the chat, HUD_PRINTNOTIFY for console, HUD_PRINTCENTER for center of the screen

joinmessagesuser = true -- true/false
joinmessageusertext = " has joined the game." -- text that pops up when player joins the game, if enabled

--[[ disconnect message --]]

disconnectmessage = true -- true/false
disconnectmessagetext = " has left the server."

--[[ miscellaneous/fun --]]

adminswepspawn = false -- true/false - do admins spawn with specific weapons?
adminswep = "weapon_example" -- specify the weapon name

kickifunauthenticated = false -- true/false - kick players who are not authenticated succesfully by steam? ( not stable, use with caution!)

setmaterialonspawn = false -- set player material on spawn
plymaterial = "..." -- specify the material name, if above is enabled

--[[ useful --]]

--[[ END OF CONFIG --]]



function PlayerDisconnected( ply )
	if disconnectmessage == true then
		PrintMessage(HUD_PRINTTALK, ply:Name().. disconnectmessagetext)
	end
end

hook.Add( "PlayerDisconnected", "Player_Disconnected_Message", PlayerDisconnected )

function PlayerJoinMessage( ply, public )		
    if joinmessagesuser == true then
        PrintMessage(joinmessageposition, ply:Name() .. joinmessageusertext)	
	if ply:IsAdmin() and joinmessagesadmin == true then
	    PrintMessage(joinmessageposition, ply:Name() .. joinmessageadmintext) 
		end
	end
end

function IfPlyIsAuthenticated( ply, public )
if kickifunauthenticated == true then
	if ply:IsFullyAuthenticated() == true then
			PrintMessage(HUD_PRINTCONSOLE, ply:Name() .. " has been succesfully authenticated.")		
	else if kickifunauthenticated == true and ply:IsFullyAuthenticated() == false then
		ply:Name(ply:Kick("You were unsuccesfully authenticated by Steam!"))
			end
		end
    end
end

function AdminSWepSPAWN( ply )
    if ply:IsAdmin() and adminswepspawn == true then
	    ply:Name(ply:Give( adminswep )) 
	end
end

function SetPlyMaterialOnSpawn( ply, public )
    if setmaterialonspawn == true and Entity.IsPlayer() == true then 
		ply:Name(Entity.SetMaterial( plymaterial ))
	end
end

Error… please…

I couldn’t understand your problem very well due to your grammar but I think your problem is you only have a hook for the disconnect one not any of the others.

Damn, is my grammar really that bad?

I need to practice

Yes they need to be on the correct hooks to be called at the correct time, for example the connect text would be “PlayerInitalSpawn”

Thank you, that seems to have worked. I appreciate your help.