This is for a game however I think all of the rules apply. I have a function which is
function nolag()
if !nolag then
nolag = true
ply:ConCommand("ax_stoplag")
elseif nolag then
nolag = false
ply:ConCommand("ax_resetlag")
end
end
The ply:ConCommand("ax_stoplag") is basically another term for print ("ax_stoplag") in my situation. However I have a button
CreateButton( "No-Lag", MISCtab, black, tblack, true, 355, 130, 95, 20, "Toggle No-Lag on and off", function () nolag() end )
So that will create a button that will then link to the nolag function. However I can click it, but when I click it again nothing happens and I get an error (error in game). And basically the nolag = true and the nolag = false is the problem and is causing the error.