It looks like you're new here. If you want to get involved, click one of these buttons!
I have made a simple script for a ladder object which means when I click on the ladder, the players position should change to the topOfLadder position but the mouse click is registering but the position of the player doesn't change to the topOfLadder position. The script is placed on the ladder object. What am I doing wrong?
This is the script:
public class GoUpLadder : MonoBehaviour
public Transform topOfLadder;
public Transform bottomOfLadder;
public Transform player;
public bool climbedUp = false;
// Start is called before the first frame update
// Update is called once per frame
if (Input.GetMouseButtonDown(0) && climbedUp == false)
player.position = topOfLadder.position;
climbedUp = true;
else if (Input.GetMouseButtonDown(0) && climbedUp == true)
player.position = bottomOfLadder.position;
climbedUp = false;