How do i make functions run fuctions?

I do not know how to make functions run functions :wink: Any help?

function TDM_RED( ply )

local RDMR = math.random ( 1, 2 )
if RDMR == 1 then ply:SetTeam( 2 )
elseif RDMR == 2 then ply:SetTeam( 2 )

This is first code

function TDM_REDT( ply )

chat.AddText( Color(255,255,255), "You are now team ", Color(255,0,0), "Red")

usermessage.Hook("TDM_REDT", TDM_REDT)

This is the function i want it to run (I know it is not local player so this text is global it is just a test)

Any help with be fantastic.


Im trying to make the first code run the second code. I coded the first function into a Derma menu for team choosing so i need it to also send a chat message with.

Could you give more information?
What are you trying to accomplish?
What are you trying to make this code do?

INB4 i just did edit it with the info what the code should do

(User was banned for this post ("Meme reply" - Craptasket))

Is the first code block in server, client or shared?

First serverside other is client side ofc. I do know where to place them. A guy teached me about serverside/clientside

You said:

Yet you said:

Which confused me. Derma is clientside only.

But if it truly is serverside, then just send a umsg to the correct clients with the name you put in your second code block.

concommand.Add("TDM_RED", TDM_RED )

At bottom of my init.lua

				button:SetText( "Red Team" )
				button:SetPos(  50, 70 )
				button:SetSize( 100, 50 )
				button.DoClick = function ()
						RunConsoleCommand( "TDM_RED")

Im not good at lua. so i should do like

RunConsoleCommand( “TDM_RED”)
umsg.Start( “TDM_REDT” )