What is wrong with this script?

I Wrote this script:
198159-cameracode.png

and it showed these errors:
198160-cameraerror.png

how do i change the code?

You seem to assigned a Vector3 variable to an int field. So in Mathf.Clamp it is expeting a float but it got a Vector3 (PlayerPos) instead.

There are two ways.

Solution 1:

using UnityEngine;

public class CubeSkinStorer : MonoBehaviour
{
    public GameObject Player;
    public Vector3 PlayerPos;
    public float xMin, xMax, yMin, yMax;
    // Start is called before the first frame update
    void Start()
    {
        Player = GameObject.FindGameObjectWithTag("Player");
        PlayerPos = Player.transform.position;
    }

    // Update is called once per frame
    void LateUpdate()
    {

        float x = Mathf.Clamp(PlayerPos.x, xMin, xMax);
        float y = Mathf.Clamp(PlayerPos.y, yMin, yMax);
    }
}

If that dosen’t work try this:

using UnityEngine;

public class CubeSkinStorer : MonoBehaviour
{
    public GameObject Player;
    public float PlayerPosX, PlayerPosY;
    public float xMin, xMax, yMin, yMax;
    // Start is called before the first frame update
    void Start()
    {
        Player = GameObject.FindGameObjectWithTag("Player");
        PlayerPosX = Player.transform.position.x;
        PlayerPosY = Player.transform.position.y;
    }

    // Update is called once per frame
    void LateUpdate()
    {

        float x = Mathf.Clamp(PlayerPosX, xMin, xMax);
        float y = Mathf.Clamp(PlayerPosY, yMin, yMax);
    }
}

Feel free to ask if you have any quesitons and please when you are asking questions again post the entire code.