Hi, everyone. I have a sword logic script running on my players sword, and it should be adding force. There are no components out of the ordinary in my game save two scripts: my inventory and my item script. Both can be viewed here. The problem is sometimes it works fine, sometimes there is a delay and then it adds force, and sometimes it doesn't respond. All help is appreciated. Here is the sword logic script:
var swordPoints : Transform[];
var swingPower : int;
var showGizmosInEditor : boolean = false;
function Update ()
{
var hit : RaycastHit;
for(i = 0; i < swordPoints.length; i++)
{
if(Physics.Linecast(transform.position, swordPoints*.position, hit))*
*{*
_Hit(swordPoints*, hit);*_
_*}*_
_*}*_
_*}*_
_*function Hit(i : Transform, hit : RaycastHit)*_
_*{*_
_*if(hit.collider.rigidbody)*_
_*{*_
_*hit.collider.rigidbody.AddExplosionForce(swingPower, i.transform.position, 1.0, 3.0);*_
_*}*_
_*if(hit.collider.tag == "Enemy")*_
_*{*_
_*hit.collider.gameObject.SendMessageUpwards("ApplyDamage", swingPower, SendMessageOptions.DontRequireReceiver);*_
_*}*_
_*}*_
_*function OnDrawGizmosSelected()*_
_*{*_
_*Gizmos.color = Color.blue;*_
_*if(showGizmosInEditor)*_
_*{*_
_*if(swordPoints.length != 0)*_
_*{*_
_*for(i = 0; i < swordPoints.length; i++)*_
_*{*_
<em>_if(swordPoints *!= null)*_</em>
<em>_*{*_</em>
<em><em>_Gizmos.DrawLine(transform.position, swordPoints*.position);*_</em></em>
<em><em>_*}*_</em></em>
<em><em>_*}*_</em></em>
<em><em>_*}*_</em></em>
<em><em>_*}*_</em></em>
<em><em>_*}*_</em></em>
<em><em>_*```*_</em></em>