hi guys i have got this script
function Update () {
var other = gameObject.GetComponent("door script");
if (gameObject.tag == "door"){
(Vector3.Distance(target.position, transform.position ) < 25);{
other.enabled = true;
}
}
if (gameObject.tag == "door"){
(Vector3.Distance(target.position, transform.position ) > 25);{
other.enabled = false;
}
}
}
which obvs doesn’t work so i was wondering if some one could help me.
what i am trying to achieve is a script that when i get within a certain distance of an object with the tag “door” it enables a script called “door script”
and when i move away a certain distance it disables the “door script” this is probably really easy to do but i just can’t figure it out.
or if anyone knows of a better way to make a door open and close when i press “e” within a certain distance of it then that would be much appreciated to thanks for the help.