How can i set up a turret that turns and shoots where you touch onscreen?,how to shoot where you touch

i’m trying to make it where the turret turns and shoots where you touch on the screen, but i’m not really sure how to do it? ,How can i make a turret turn and shoot where you touch on the screen?

You’ll need to use some of the Raycast functions to identify a point where you click on the map. Something like this from one of my programs (you’d need to change it to suit yours).

	private void Update () {
		// on right click...
		if (Input.GetMouseButtonDown(1)) {
			RaycastHit hit;
			// this is an easier way of creating a ray from mouse click
			if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit)) {
				// instead of checking tag, get the script directly
				UnitSphere unitClicked = hit.collider.GetComponent<UnitSphere>();
				if (unitClicked != null) {
					// change selection, wrapped into a function
				// clicked on something else; you might want to check if it is terrain
				else {
					// if there is a unit selected...
					if (selectedUnit != null) {
						if (Input.GetKey(KeyCode.LeftShift)) {
						else {
							// unselect as you do in your example; 
							// however, it would be better to have selection/unselection on a different button!

Take out the select code that will get the hit.point on the map where you click. After that, you would want your turret object to (probably) “Look At” the hit point and fire away with your projectile hitting in or around the hit.point. You’ll probably need to look up how to use “Look at” to accomplish what you need to do.
Lots of other ways to do it. But I think this is the easiest.

thank you, i will try this.