'end' expected (to close 'if' at line 108)

This is my code


function SWEP:SecondaryAttack()

	if ( SERVER ) then
	
		if ( not self:CanSecondaryAttack() ) or self.Owner:IsOnGround() == false then return end
		
	    self.Owner:DoAnimationEvent(ACT_ZOMBIE_LEAP)
		local JumpSounds = { "npc/fast_zombie/leap1.wav", "npc/zombie/zo_attack2.wav", "npc/fast_zombie/fz_alert_close1.wav", "npc/zombie/zombie_alert1.wav" }
		self.SecondaryDelay = CurTime()+10
		self.Owner:SetVelocity( self.Owner:GetForward() * 200 + Vector(0,0,400) )
		self.Owner:EmitSound( JumpSounds[math.random(4)], 100, 100 )
		self:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
		self.Owner:DoAnimationEvent(ACT_ZOMBIE_LEAPING)
 		 until( self.Owner:IsOnGround() == true )

		 end
	end
end

Line 108 is


if ( SERVER ) then

It works fine if I remove


self.Owner:DoAnimationEvent(ACT_ZOMBIE_LEAPING)
 		 until( self.Owner:IsOnGround() == true )

		 end

Don’t think you know what ‘until’ does.

Repeats until a statement is true

Its caused due to until, as its a loop function. Why are you even calling it like that?

[editline]27th July 2017[/editline]

Take up a look at this please

So as long as Im in the air im doing ACT_ZOMBIE_LEAPING

You shouldn’t accomplish this like that then, its going to cause the server to crash. You should use either a hook as Think or tick for this kind of things.

[editline]27th July 2017[/editline]

Ok thank you

[editline]27th July 2017[/editline]

How would I do something like


self.Owner:DoAnimationEvent(ACT_ZOMBIE_LEAPING)
wait(3)
self.Owner:DoAnimationEvent(ACT_ZOMBIE_LEAPING)


[editline]27th July 2017[/editline]

or do the taunt for a specific amount of time

[editline]27th July 2017[/editline]

nvm i got it