hello everyone,i need help. i made script for teleport and its not working
var home_place: Transform;
var Player: Transform;
function Update() {
if(Input.GetKey ("h"));
home_place.position = Player.position;
if(Input.GetKey ("e"));
Player.position = home_place.position;
}
i tried to put GetButtonDown and still dont work
help
sry for bad eng :S
Never make if statements without the curly braces {…}
It’s just one more way you can make mistakes, like you have with the placement of your terminator ; characters.
var home_place: Transform;
var Player: Transform;
function Update() {
if(Input.GetKey ("h")) {
home_place.position = Player.position;
}
if(Input.GetKey ("e")) {
Player.position = home_place.position;
}
}
the above code should work how you’d expect.