while true do game.Workspace.BrokenCeiling.Sparkle.ParticleEmitter.Enabled = false wait(.2) game.Workspace.BrokenCeiling.Sparkle.ParticleEmitter.Enabled = true wait(.2) game.Workspace.BrokenCeiling.Sparkle.ParticleEmitter.Enabled = false end
People tell me scripting like this is frowned upon. Please tell me how to narrow this down to something more sophisticated?
You can usenot
to toggle between false
and true
.
while wait(0.2) do game.Workspace.BrokenCeiling.Sparkle.ParticleEmitter.Enabled = not game.Workspace.BrokenCeiling.Sparkle.ParticleEmitter.Enabled--If this is false then it will be changed to true and if its true then it will be false. end
~UserOnly16Charcters, Hoped I helped you to answer your question! If you have any further question, don't hesitate to comment below!!
To expand on user's answer a bit, not
reverses a boolean value.
print(not true) --> false print(not false) --> true
Therefore in his example code, you are setting the Enabled property to whatever it doesn't currently equal - to its opposite.
To shorten that annoyingly long path, you can just put this script inside the ParticleEmitter itself, then just use script.Parent
;
while wait(0.2) do script.Parent.Enabled = not script.Parent.Enabled end