How can I make a sparks system?

  1. What do you want to achieve? Keep it simple and clear!
    I want to make sparks appear if a part is being dragged on the ground at a speed so if the speed is above 15 then the sparks will appear on the side thats being scraped on the ground and if the speed of the part is below 15 the sparks will slowly disappear. Also the higher the speed the more visible the sparks are. I know this will have something to do with the velocity of the part.

  2. What is the issue? Include screenshots / videos if possible!
    There are no tutorials on YT on how to do it, I found 1 Devforum post but i still don’t really understand it.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried YT and Devforum.

1 Like

You can break the system into theae three components.

Dragged on the ground = collision check every frame, you can use raycasting, :GetPartsInPart, etc.

To measure speed you use .AssemblyLunearVelocity.Magnitude.

You can convert the magnitude number through a linear formula or multiplier to convert it into emitter rate for more sparks and enable and disable it.

Example formula

local emitterRate = speed*10

linear since in a graph it will look like a straight line.

1 Like

Ok, could you provide me with an example code for the colliding with part system. Once i get that done im pretty sure i can code the rest. I also don’t want the sparks to appear if its being dragged on terrain.

You can try this