Hello! I am trying to make it to where my gun won't fire until the reload animation is finished, but I'm having some trouble. I don't see what is wrong with `{if (!gameObject.transform.parent.transform.FindChild("Gun").GetComponent.().isPlaying)` , but hopefully, you could help me fix it! In another script that's actually attached to the gun itself, `{if (!GetComponent.().isPlaying)` works fine.
var DamageAmount : int = 34;
var TargetDistance : float;
var AllowedRange : float = 75;
function Update()
{if (!gameObject.transform.parent.transform.FindChild("Gun").GetComponent.().isPlaying) {
{if(Input.GetButtonDown("Attack"))
{var Shot : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), Shot))
{TargetDistance = Shot.distance;
if (TargetDistance < AllowedRange)
{Shot.transform.SendMessage("DeductPoints", DamageAmount);}}}}}}
↧