how would I change the spawnpoint variable of my health script to spawn at any one of my level’s spawnpoint objects instead of a fixed spawnpoint
var PointCube : Transform;
var spawneffect : Transform;
var SpawnPoint : Transform;
var respawn : boolean = false;
var health:float = 90;
function Damage(dmg:float){
health -= dmg;
}
function Update (){
if(health <=0){
Instantiate (PointCube,transform.position,transform.rotation);
transform.position = SpawnPoint.position;
Instantiate (spawneffect,transform.position,transform.rotation);
var audio: AudioSource = GetComponent.();
audio.Play();
audio.Play(44100);
health += 100;
}
}