transform.position not doing anything

So I’ve been making a game with a battle system. When the player presses down z or enter in the menu they enter an attack. So I made this code to teleport the character into the attack box and shrink them down. But they get shrunk down and don’t teleport. Everything but transform.position works. This is a sprite in a 2D game if that helps.

if (Input.GetKeyDown ("z") || Input.GetKeyDown ("return")) { textbox.SetActive (false); bulletboard.SetActive (true); soul.transform.position = new Vector3 (-0.3423029f, -1.97f, 0f); soul.transform.localScale = new Vector3 (0.1f, 0.1f, 0f); isfighting = true; }

Thanks in advance!

Make a empty gameobject wherever your soul wanted to teleport. Then make a public Transform variable to store this empty soul’s transform position, And drag it to the inspector. So, Instead of writing a raw xyz position of soul you can just use this empty gameobject’s position which you setup in the scene where you want to teleport. You can do same for scaling too. Just scale down to 0.1f’s to it scaling transform of empty game object. and set it like soul.transform.position = teleportPos; and soul.transform.localScale = teleportScale respectively.