Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Need Particle Emitter to only be ENABLED when its parent ISN'T Transparent?

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

1 answer

✓ Accepted answer

heres a script lol

its a normal script btw

hope this helps

--if you want to change the min trancparency before the particles turn off then change the
--	"if part.Transparency X= 0.5 then" line

part = script.Parent
particle = part.ParticleEmitter

while true do
	if part.Transparency >= 0.5 then 
	particle.Enabled = false
	end

	if part.Transparency <= 0.5 then
	particle.Enabled = true
	end

	wait(0.1)
end

2 comments

0

You should avoid using wait() instead you can; part:GetPropertyChangedSignal("Transparency"):Connect(function(); then you can put your if statements inside the function

0

Thank you so much guys! :)

This discussion is preserved as it was. New answers, comments, and votes are closed.