Random Encounter Scene change breaking player movement

Code for random encounter:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class RandomEncounter : MonoBehaviour
{
private int randomnumber = Random.Range(0, 10);
private const int maxnum = 10;

void OnTriggerEnter(Collider other)
{
    if (other.CompareTag("Player"))
    {
        if (randomnumber == maxnum)
        {
            SceneManager.LoadScene(sceneName: "Battle");
        }
        else
        {
            randomnumber = Random.Range(0, 10);
        }
    }
    
    
}

}

Code for player controller
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;

public class APlayer : MonoBehaviour
{
public float movementSpeed = 10;
public float turningSpeed = 100;
void Update()
{
float horizontal = Input.GetAxis(“Horizontal”) * turningSpeed * Time.deltaTime;
transform.Rotate(0, horizontal, 0);

    float vertical = Input.GetAxis("Vertical") * movementSpeed * Time.deltaTime;
    transform.Translate(0, 0, vertical);
}

}

There is no other defined variables that could interrupt and I do not know what could be the problem

Sounds like you wrote a bug… and that means… time to start debugging!

By debugging you can find out exactly what your program is doing so you can fix it.

Use the above techniques to get the information you need in order to reason about what the problem is.

You can also use Debug.Log(...); statements to find out if any of your code is even running. Don’t assume it is.

Once you understand what the problem is, you may begin to reason about a solution to the problem.