I want to be able to press a button and the particle emitter to turn off, but it isn't working. This is what I have right now.
function onClicked(playerWhoClicked) script.Parent.Parent.Fire1.Flame.Lifetime.Max.Value = 0 end script.Parent.ClickDetector.MouseClick:connect(onClicked)
If someone could tell me what I'm doing wrong or even how to make the script set the rate to 0, that would be really great.
Hi!
Your problem is actually quite simple! You are setting incorrect value properties. The particle emitter does not let you physically set one value such as Max. You have to use a NumberRange
in this instance.
A NumberRange can be generated such as NumberRange.new(1, 10)
Your code in conclusion should look like this:
function onClicked(playerWhoClicked) -- I'm not sure what your min value would be so I've left it as ? script.Parent.Parent.Fire1.Flame.Lifetime = NumberRange.new(?, 10) end script.Parent.ClickDetector.MouseClick:connect(onClicked)
However, you could just simply disable the particle emitter with the code:
function onClicked(playerWhoClicked) script.Parent.Parent.Fire1.Flame.Enabled = false end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Hope this helped!