Lua script for +attack and -attack?

I need the pros of Garrysmod to tell me what I’m doing wrong. I want to attack once, and stop. Any positive/negative criticism welcomed.

local function rope()

	timer.Simple( 1, LClick)


function LClick()




This’ll attack multiple times if you’re using an automatic weapon (as +attack is toggled for a whole second)

I don’t see why you’d disagree when I fixed the issue in the code he posted.

The arguments to timer.Simple are delay, function. He’s used it correctly.

concommand.Add( “roper”, function( )
RunConsoleCommand( “+attack” )

timer.Simple( 0.001, function( ) RunConsoleCommand( "-attack" ) end )

end )

It doesn’t honestly make a difference how you code it. Every coder has their own style. My style does not involve making useless functions.

You could just use 0 for next tick (frame?) in a timer.

You could, just wanted to show that you can adjust the delay past 1.