I'm trying to make a script that effects all the children of a parent because I don't want to use too much scripts parented in a part, but I got confused on how to use GetAllChildren. I tried to name all the parts in the model, "Part" but this script located in the model only effected 1 part. Here is a script in the parent.
note that im not asking to FIX the script, im asking on how to use GetAllChildren.
local parent = script.Parent.Part
local basicColor = BrickColor.new("Institutional white")
local basicMaterial = "SmoothPlastic"
local material = "Neon"
local orange = BrickColor.new("Br. yellowish orange")
local black = BrickColor.new("Black")
local neon = BrickColor.new("Neon orange")
local brown = BrickColor.new("CGA brown")
local debounce = false
local function onTouch(hit)
if debounce then
return
end
debounce = true
parent.FireEffect.Enabled = true
parent.Material = material
parent.BrickColor = orange
wait (0.8)
parent.Transparency = 1
parent.FireEffect.Enabled = false
parent.CanCollide = false
debounce = false
wait (4)
parent.Transparency = 0
parent.CanCollide = true
parent.Material = basicMaterial
parent.BrickColor = basicColor
end
parent.Touched:Connect(onTouch)
The "Parent" is a model and the "Children" are blocks called parts. If anyone would give me a script instead of just sending the ROBLOX Wiki page of GetAllChildren, that would be helpful since I'm a beginner scripter. Thanks!

1 comment
Please accept my answer if that works. Thank you!