rParticle: The light weight, open source, GUI particle system

I forgot to add it! Thanks!
It should be available now.

1 Like

Great resource!

Everything has been great with the module, but I’m sad to see there is no :Emit like function.

The closest thing to the ParticleEmitter:Emit() is doing:

    ParticleEmitter.rate = 1;
	task.wait(1);
	ParticleEmitter.rate = 0;

which occasionally doesn’t even work.

it would be a lot more optimized if we got a function like:

ParticleEmitter:Emit(5) -- fire 5 particles
1 Like

Ah, so the reason that doesn’t always work is due to how the particle emitter is designed. That being said. If a :Emit function were added it would be trivial to work it into the existing project such that your edge case becomes possible.

I will try my best to add that tonight!

Pretty sure that’s just a sprite sheet.

1 Like

It’s possible. That may be the case :man_shrugging:
Seems that the person was asking how to recreate that effect with rParticle though.
If you want to, you could use some kind of sprite sheet in combination with rParticle to do something like this.

I’ve implemented a public :Emit function.

Here is an example of how that can be used

local ParticleEmitter = require(game.ReplicatedStorage.Source.ParticleEmitter)

local emitter = ParticleEmitter.new(script.Parent, game.ReplicatedStorage.Particle)
emitter.onSpawn = function(particle)
	print("Spawned!")
	particle.element.BackgroundColor3 = BrickColor.Random().Color
	particle.maxAge = 10000
	particle.velocity = Vector2.new(math.random(-3,3) / 3 + 0.1, math.random(-3,3) / 3 + 0.1)
end

emitter.onUpdate = function(particle, delta)
	particle.position = particle.position + particle.velocity
end

emitter.rate = 0

print("Waiting")
task.wait(5)

print("Emitting")
emitter:Emit(5)

This results in something that looks like this:

Hopefully you can see that 5 particles were fired all at once after a brief wait period.


I haven’t created a release for this yet, so if your seeing this before I do that you can fetch the most up to date code from the repository it’s self and use it that way. Check the original post for the link to that.

3 Likes

Ah! So that’s why :Emit() wasn’t working on this. Please update the documentation to reflect that if it’s not available for use please! Love where you’re going with this otherwise.

1 Like

Thanks for the response! I got sidetracked for a few months with school stuff, but I will update the current docs so others won’t get confused!

Then I’ll look into releasing the most up-to-date code.

1 Like

Released v1.3

This version simply adds the :Emit(int count) function to the particle emitter. I was originally waiting to release this version until there were more features to add. But at this point I feel I’m mostly happy with where the project is at.

If there are any issues or further suggestions for improvements please leave an issue in the git repo!

1 Like

How do I set the particle’s Position? I keep getting an invalid argument error whenever I try to set one.

Error message:

This is super cool, and will definitely help with gui enhancement in the future!
Is there any way to change the duration the particles last for, so they don’t fall all the way down to the bottom of the screen?

1 Like

Sorry! Im just now realizing that the documentation doesn’t make this clear. But the position property on a particle is a Vector2 not a UDim2. The conversion to UDim2 happens in the background so make sure you are using Vector2!

2 Likes

The age property is what you are looking for here. Setting the age to something smaller will decrease the time that the particle is visible for.

1 Like

Very cool! Messed around for 30 minutes and made a button click effect. Model below if anyone would like it :slight_smile:

5 Likes

Ah, thank you so much! This has been exactly what I was looking for a while now.

1 Like

This looks super cool! Glad that you were able to get it working!

2 Likes

Of course! If you have any further questions feel free to ask!

1 Like

I’d also put on the documentation that Position uses Offset rather than scale. It took me a long time to figure out what was wrong :stuck_out_tongue:

For anyone wondering to add scale (even though you can easily change it in the modulescript)

particle.position = Vector2.new(ScaleX * hook.AbsoluteSize.X, ScaleY * hook.AbsoluteSize.Y)
2 Likes

Does this support flipbook textures?

The library itself only handles emitting particles. How the particle acts or the logic it contains is independent of this library. So if you create a particle that uses flipbook textures, then yes, the library can use it like it would any other UI element.