Hello. I made a script, which in theory should work, but doesn't. I want it to when I click, while in the collider, destroy the prop and display the phone. It's kind of like a fake pick-up system. Please help!
PickupPhone.js:
#pragma strict
var guitext : GUIText;
var phone : GameObject;
function OnTriggerEnter (other : Collider){
if(other.gameObject.tag == "Player") {
guitext.text = "click to pick up the phone";
{
if(Input.GetMouseButtonDown(0)){
phone.active = true;
Destroy(gameObject);
}
}
}
}
function OnTriggerExit (other : Collider){
if(other.gameObject.tag == "Player") {
guitext.text = "";
}
}
↧