Go to object when hits = 0

well basically, i’am makeing a stragety game and i’ave encoutrned a problem, i’ave got a lumber jack to cut down tress, the harvest script is working but i would like it when it’s hit a tree 5 times it goes back to his hut to drop off the wood before going back. but i don’t know how to script that, (it’s only the going back to a certain object when hits = 5)

im not a good scripter but aint (curent position - shedposition = distance to get back)

then use x,y,z translate to get back to it with the distance you get from the calcul from abouve then if distance <= 0 , somehting else happen liek going back to another tree

Might want to include a check everytime you add a a hit.
Something like this(provided I dont know how you’ve done your code)

function HitTree(){
hitCount+=1;
if(hitCount == 5){
	hitCount = 0;
}

}

is that what your looking for?