This tool punches for 4 seconds and if activated while punching, kicks.
tool.Events.Combat.OnServerEvent:connect(function(player)
punching = false
if punching == false then
punching = true
--Combat Code here
combatanim:Play()
wait(4) --Punches for 4 seconds
combatanim:Stop()
punching = false
elseif punching == true then --If activated while punching, kick
punching = false
combatanim:Stop() --No longer a need to wait() because the animation was stopped
kickanimation:Play()
end
end)
Works fine but depending on how soon I kick, the wait stops the animation on the next go around. So if I start punching again after kicking, the 4 second wait kicks-in (pun not intended) and stops it. How can I stop the previous 'if' from stopping the animations when the function runs again?
