this is my current script:
while true do print(script.Parent.Part1.Anchored) print(script.Parent.Humanoid.Health) wait(20) script.Parent.Part1.Anchored = false script.Parent.Part2.Anchored = false script.Parent.Part3.Anchored = false script.Parent.Humanoid.Health = 0 print(script.Parent.Humanoid.Health) end
I think to do what I want it to, I would have to use the GetChildren Function? I dont really understand it though.
Family Tree: https://gyazo.com/34cdfcb7cb3ac03c1279db43b35aeaa6
GetChildren Explanation
GetChildren
is a function of Instance
that returns a table of Instance
s. You can loop through this to modify each child.
How to Use GetChildren
Using it is actually pretty simple when you figure it out. Look at my example below. It will do a for
loop on the children and then check their class to make sure they are actually parts.
for i,v in pairs(script.Parent:GetChildren()) do if v:IsA("BasePart") then -- BaseParts are basically what you want to use when checking through different types of parts in order to achieve the same result v.Anchored = false end end