The player does not rotate even though it supposed to.

Hi i am making a script that rotates the charecter when a button pressed.Heres the script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayButtonScript : MonoBehaviour
{
    private CharecterMovementScript charecterMovementScript;
    private GunScript gunScript;
    private CameraRotation cameraRotation;
    public GameObject Player;
    public GameObject Gun;
    public GameObject TheMenu;
    public GameObject crosshair;
    public GameObject PlayerSpawnPoint;
    void Start()
    {
        charecterMovementScript = FindObjectOfType<CharecterMovementScript>();
        gunScript = FindObjectOfType<GunScript>();
        cameraRotation = FindObjectOfType<CameraRotation>();
        Player = FindObjectOfType<GameObject>();
    }
    public void OnButtonPress()
    {
        charecterMovementScript.enabled = true;
        gunScript.enabled = true;
        cameraRotation.enabled = true;
        Gun.SetActive(true);
        Cursor.lockState = CursorLockMode.Locked;
        TheMenu.SetActive(false);
        crosshair.SetActive(true);
        Player.transform.Rotate(0f, 180f, 0f)
    }
}

It should work but it doesn’t and idk why.
and the players rotation is 0,0,0.
Idk why it happens,can someone help?

Assuming that OnButtonPress() is being called by a UI button that you linked it to correctly then the function should be called. Are there any errors that are being called? Also noticed that your player is not properly assigned unless you only have 1 object in your scene. You should tag your player and search by that.

Player = GameObject.FindGameObjectWithTag("Player");

GL and happy coding!

Nevermind i fixed it.I made an empty game object and called it a spawn position and called it a day.(what’s that?What about rotation you ask?The rotation has been fixed too!)