how can i restrict Ball movement in -ve X axis ......?

hi,

I’m trying a ball game. Here i have some problem i want to restrict my ball movement on -ve x axis.
and also i tried Mathf.clamp. but did’t work for me.

transform.position = new Vector3(Mathf.Clamp(transform.position.x,5,500),transform.position.y,transform.position.z)

i need update my MinX value in with screen size. Please suggest me

the clamp does need to be in the update. if it is, i dont know whats wrong. but his usualy works for me.

using UnityEngine;
 using System.Collections;
 
 public class limitPlayer : MonoBehaviour {
     public float minimumX = -10f;
     public float maximumX =10f;
     public float minimumY = -9.8f;
     public float maximumY =9.8f;
     public float minimumZ = -20f;
     public float maximumZ =20f;
     // Use this for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
         transform.position = new Vector3 (Mathf.Clamp (transform.position.x, minimumX, maximumX), Mathf.Clamp (transform.position.y, minimumY, maximumY), Mathf.Clamp (transform.position.z, minimumZ, maximumZ));
     }
 }