How can I make a raycast have a trail effect?

There isn’t really a correct function. Just a matter of properly doing the math to get each vector.

One vector will probably be your character or some point on/near him.

The other vector will be the target.

For my trace Vectors, I get Playcontroller, Convert Mouse Location to World Space, use World Location for the Start, and then Add World Location to World Direction for the end point.