Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Adding particles to a gun firing?

Asked by 6 years ago

I understand particles and how to add them to parts. But what I'm really lost with is how to add temporary particles, more specifically, particles for guns. I don't know how to code my particles so that they appear only for a fraction of a second when firing a gun, then make them disappear. Any help would be greatly appreciated because I really need gun particles to make my game realistic.

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

I suppose what would work is after the fire event making it non-Transparent then doing like a wait(.1) then making it Transparent once more

Example Edit:

function fire()
script.Parent.ParticleEmitter.Transparency = 0
wait(.1)
script.Parent.ParticleEmitter.Transparency = 1

P.S. I'm not very good at scripting guns, but this is merely an example of what I think it should look like.

0
I understand your answer and I’ve been playing around with it, but I can’t figure out how to code a transparency change for a particle emmiter. I can code a transparency change for parts, but not a particle emmiter. Could you give me an exmaple or something. tygerupercut3 68 — 6y
0
I gave you an example of what I think could work in my answer. Conquesias 85 — 6y
0
Thanks for the example. After a lot of testing, I discovered that the transparency of a ParticleEmitter can't be set in a script, as far as I know. Instead, I set the rate to 0 and set it to 100 every time the weapon is fired. It produces a very similar effect and uses a very similar script to yours. Thank you for pointing me on the right track. tygerupercut3 68 — 6y
Ad

Answer this question