Neon GUI - Draw particles on 2D Gui (e.g. on ScreenGui) - Free script & demo

Hello Guys,

Today I’ve continued my “draw polygons on GUI” demo project.
I think, this step is quite interesting :slight_smile:

This demo can do a lot:

  • first of all, it DRAWS PARTICLE EMITTERS ON THE SCREENGUI - or is it just a trick?.. check it out!
  • dynamically changes the mouse cursor depending on the current action
  • 5 buttons to control the drawing (on/off drawing, reset drawing, hide lines, hide markers)

As always, you can edit the script in Studio, all codes are free to use.

Note: this is not a real OOP kind of script, rather a “I want to do it, because I can do it”. The 3 scripts sum up to 500 lines, so it is not a “one-function” code any more, but I think it is still quite easy-to-read.

All objects and scripts are located in StarterGui\neonGui - no other folder is used.


Here I highlight the simplified function that draws the line on the GUI with particles - as you may guessed, this is a hidden 3D “Part” object stick to the camera:

function addLine3D(m1:Vector3, m2:Vector3)
	local ray1 = Camera:ScreenPointToRay(m1.X, m1.Y, 1)
	local ray2 = Camera:ScreenPointToRay(m2.X, m2.Y, 1)

	local r1 = ray1.Origin + ray1.Direction
	local r2 = ray2.Origin + ray2.Direction
	local line3D ="Part")
	local XSIZE:number = .001 -- no need any visible depth
	local ZSIZE:number = .02 -- this is the width of the part facing to the camera
	line3D.CFrame =, r1) * CFrame.Angles(math.pi/2, 0, 0)
	line3D.Size =,(r2-r1).Magnitude, ZSIZE)


  • m1 and m2 are GUI pixel positions, e.g. as coming from Mouse object.
  • line3D is not visible (Transparency = 1).
  • Particle emitter is parented to this hidden line3D object, that’s how it works.

Find the whole function and more in the demo!
May you like this concept (or may not), drop a line below!


don’t get me wrong, it is cool, but since it is just a trick, why do you keep saying on ScreenGui as if it is 2d particles

1 Like

No problem, I understand why you ask it. There are very limited possibilities to use particle emitters on Gui, so I wanted to test a creative workaround.

While the emitters are not parented into the ScreenGui (it wouldn’t work, of course), but they are aligned with Gui objects of the ScreenGui. From the practical point of view (e.g. from player’s aspect), they are on the ScrenGui.

I hope it is acceptable answer.