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

Children and Effects (?)

I have a model with various parts. Each one of them has a smoke effect.

Img

I have a script in which i want to enable and disable all of them at once.

How can i do this?

1 answer

✓ Accepted answer

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.

2 comments

0

Thanks, i knew there was something to check if a item was "X" but i forgot what. And this reminded me. Thanks!

0

:GetDescendants() will be quite useful to me in the future lol!

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