damage script not working

well i am making a zombie game and i made the zombie to chase me or follow me but the problem is they are not damaging me they collide to me but doesn’t hit me. i’m attachinf enemy attack script and player health script plzz reply asap

3056803–229507–EnemyAttack.cs (1.16 KB)

Does Attack() get called?

sorry i’m new to scripting but what are you trying to say

does the Debug.Log ever print anything? (inside Attack() method)

Debug.Log (direction);

nope nothing

enemy just comes to player and starts colliding without damaging

try printing out distance and maxdistance,

float distance = Vector3.Distance (target.position, myTransform.position);
Debug.Log(distance+" should be less than "+maxDistance);
1 Like

still not damaging
i’m posting my player health script plzz check

3056853–229514–PlayerHealth.cs (635 Bytes)

what values does it print?

sorry but how do i check the values. I have really startedscripting few days ago

can open output console from Window / Console
those Debug.Log() commands will output text there.

you should really check few tutorials first, will be much easier to fix scripts then :slight_smile:
https://unity3d.com/learn/tutorials

1 Like

okay i’ll surely check out those tutorials and in console it’s written
“0.8530781
UnityEngine.Debug:Log(Object)
EnemyAttack:Attack() (at Assets/Zombie/EnemyAttack.cs:46)
EnemyAttack:Update() (at Assets/Zombie/EnemyAttack.cs:31)”

print out the max distance also, to check

1 Like

thanx for your help man my scipts now working:):slight_smile: