Question by
Kennedy_Wyatt · Jan 01, 2018 at 10:15 PM ·
scripting problem
Hey, I'm having trouble with my gun. I;m makeing a FPS and when i press play my gun lookes all pinched up
I get an error that says SendMessage DeductPoints has no receiver! UnityEngine.Component:SendMessage(String, Object) Gun1Damage:Update() (at Assets/Scripts/Gun1Damage.js:12) Here is the script.........
var DamageAmount : int = 5; var TargetDistance : float; var AllowedRange : float = 100;
function Update () { if(Input.GetButtonDown('Fire1')) {
var Shot : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), Shot)) {
TargetDistance = Shot.distance;
if (TargetDistance < AllowedRange) {
Shot.transform.SendMessage("DeductPoints", DamageAmount);
}
}
}
}
Comment
Your answer
Follow this Question
Related Questions
example of new way to load levels 1 Answer
Menu object not responding 0 Answers
Global Illumination at Runtime 0 Answers
Moving an image on the X axis is not working as it should. 0 Answers
only menu1 hides on gui click 1 Answer