I need your help with this system of particles, good with this code

(I use it for the character to change direction and rotate 180º on the “x” axis every time I tap or click) now, what I want is to know where (under what line of code should I code and what should I code so that at the same time I click on it activates a particle system that I have already configured
(I am very new in programming and in unity “please help”), this is the whole code:

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

public class movement: MonoBehaviour {

private float xLimit = 7.7f;
private float moveSpeed;
private Animator anim;

private bool movingRight = true;
private int direction = 1;
private bool startMoving = false;

// Use this for initialization
void Start () {


// Update is called once per frame
void Update () {
if (Input.GetMouseButtonDown (0) && startMoving == false) {
startMoving = true;
if (Input.GetMouseButtonDown (0)) {
movingRight =! movingRight;
direction = -direction;
transform.localScale = new Vector3 (direction, 1, 1);
if (startMoving == false)
changeDirection ();

transform.position + = Vector3.right * moveSpeed ​​* Time.deltaTime * direction;
transform.position = new Vector3 (Mathf.Clamp (transform.position.x, -7.8f, xLimit), transform.position.y, transform.position.z);
anim.SetBool ("Start", startMoving);
void changeDirection () {
if (movingRight && transform.position.x> = xLimit) {
movingRight = false;
direction = -1;
transform.localScale = new Vector3 (direction, 1, 1);
if (! movingRight && transform.position.x <= -7.8f) {
movingRight = true;
direction = 1;
transform.localScale = new Vector3 (direction, 1, 1);

In your movement script, create a public ParticleSystem variable (e.g. “ps”) so you can assign your effect gameObject already in place of the scene, make sure you uncheck “play on awake” of you particle effect. Then in you chagedirection() function, add the action of ps.play;

One common beginner mistake is that many assign the particle effect PREFAB from the asset project folder. In such case, in Start() you need to instantiate the prefab object into a GameObject variable in the scene first, then GetComponent of the ParticleSystem for that ps variable.