When I made a PlayerReset Script, I can't even move.

Okay, so right now my game is where the player can’t bump into any objects, if he does, you fly into space. WASD are the movement keys, but for some reason, when I use a script to be able to hit the “V” key to reset his position, I can’t even move, whenever I try to move the character, the position is instantly set back to 0,0,0 I believe, possible a few decimals off. Sorry I’ve been asking a lot of questions guys, thanks for answering them though :slight_smile:

--------Player movement script:

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {

private float PlayerMovementSpeed = 10f;
private float PlayerRotateSpped = 50f;
// Use this for initialization
void Start () {
}

// Update is called once per frame
void Update () {
	if(Input.GetKey(KeyCode.W))
	{
		transform.Translate(Vector3.forward * PlayerMovementSpeed * Time.deltaTime);
	}
	if(Input.GetKey(KeyCode.S))
	{
		transform.Translate(-Vector3.forward * PlayerMovementSpeed * Time.deltaTime);
	}
	if(Input.GetKey(KeyCode.D))
	{
		transform.Rotate(Vector3.up * PlayerRotateSpped * Time.deltaTime);
	}
	if(Input.GetKey(KeyCode.A))
	{
		transform.Rotate(-Vector3.up * PlayerRotateSpped * Time.deltaTime);
	}
}

}

------Player Reset Script

using UnityEngine;
using System.Collections;

public class BasicPlayerReset : MonoBehaviour {

private Vector3 newPos;
void Awake(){
	newPos = transform.position;
}
// Use this for initialization
void Start () {
}

// Update is called once per frame
void Update () {
	ChangePosition();
}
void ChangePosition(){
	Vector3 PlayerSpawn = new Vector3(0f , .9f , 0f);

	if(Input.GetKey(KeyCode.V)){
		newPos = PlayerSpawn;
	}
	
	transform.position = newPos;
}

}

I hit the W key, and I get instantly reset back to where I started off from, but A and D work, as they are rotation, not movement. S does the same as W. When I disable the reset script, everything is fine.

Another side question as well, if my cube that is the player, touches something and is shot into space, then when this does work, and I hit “V” to reset the player position, how would i make it reset the rotation as well? SORRY FOR SUCH A LONG POST, THANK YOU VERY MUCH IN ADVANCE.
-Alec
(Watching some vids now, hopefully I can understand some stuff better.)

Your Update() is calling ChangePosition() every frame. In ChangePosition() you set the player potition to newPos. So you are setting the player to newPos every frame, in other words reteurning the player to the same spot constantly.

Put :

transform.position = newPos;

inside here like this, then it only does this when you press V :

if(Input.GetKey(KeyCode.V)){
    newPos = PlayerSpawn;
    transform.position = newPos;
}