I've been trying to write a code which turns on/off the particle emitter depending on its parents transparency.
I want it so that if the parents transparency ==1 then the particle emitter is disabled, and the opposite if the parents transparency is ==0.
I am not too experienced in scripting lua and I just cannot figure this out. I also tried putting it in a while true do but that also doesn't work. Can anyone propose a fix/ something different?
Thank you for reading :)
This is what I have come up with:
local part = script.Parent
local particles = part.ParticleEmitter
if part.Transparency ==1 then
particles.Enabled = false
elseif part.Transparency==0 then
particles.Enabled = true
end

2 comments
You should avoid using wait() instead you can; part:GetPropertyChangedSignal("Transparency"):Connect(function(); then you can put your if statements inside the function
Thank you so much guys! :)