I need help wit the leave it to cleaver this is my code:-- This shows how to define a function called cleaveWhenClose
– The function defines a parameter called target
local function cleaveWhenClose(target)
if hero:distanceTo(target) < 5 then
– If cleave is ready, then cleave target
– else, just attack target!
– This code is not part of the function.
while true do
local enemy = hero:findNearestEnemy()
if enemy then
– Note that inside cleaveWhenClose, we refer to the enemy as target.