I have a model with various parts. Each one of them has a smoke effect.
I have a script in which i want to enable and disable all of them at once.
How can i do this?
I have a model with various parts. Each one of them has a smoke effect.
I have a script in which i want to enable and disable all of them at once.
How can i do this?
I recently discovered a useful trick to change data of the children or descendants. It will be useful in your case too. You gotta put this script in your model. It goes like this:
local parts = script.Parent:GetDescendants()
function DisableSmoke()
for i,v in pairs(parts) do
if v:IsA("Smoke") then
v.Enabled = false
end
end
end
DisableSmoke()
I will let you do the enable part yourself, because you'll learn from it.
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Thanks, i knew there was something to check if a item was "X" but i forgot what. And this reminded me. Thanks!
:GetDescendants() will be quite useful to me in the future lol!