Mussle flash script file

hey guys I’m making a survival horror fps game and I’m trying to add muzzle flash script to my shotgun that emits the particle only when the left mouse key is pressed I’ve tired many scripts that people have put up on the forums for it but they all end up with compile errors when I copy and paste them in.

does anyone have a free muzzle flash script file that I can download for my project because I’m new to unity and have no idea how to ‘drive’ the script editor.

thanks

Make the particle system duration short (maybe equal to the lifetime). Turn off looping and turn off play on awake. Set emission to 0, add a burst: at time 0, particle count 1 if its sprite sheet, otherwise set it to whatever you want.
Call Play() from the script whenever it is fired.