how how to make a lot of “KillBricks” in the folder named “Obstacle” to lift up.
script is local and located inside of folder, in folder two parts “Platform3” that can be touched but inside this each parts i have another part that if touched then “KillBricks” is changing position
local part = workspace.P3.Platform3
local moving = workspace.Obstacle:GetDescendants("Part")
part.Touched:Connect(function(hit)
print("work")
moving.CFrame = CFrame.new(0, -25, 0)
end)
In order to lift up a part you can simply do part.Position += Vector3.new(0, 25, 0) -- add's 25 on the Y axis
You also try to call GetDescendants() with a parameter “Part”, altough the method doesn’t take any params.
You also make a new Index CFrame for a table, and not change the parts CFrames
Firstly; we need to get all the KillBricks. In your case, it’d be best to make a seperate folder with JUST the kill bricks
Then to get them, you do local movingParts = workspace.Obstacle.KillBricks:GetChildren()
Secondly;
You loop trough each one, adding the position:
for _, part in movingParts do
part.Position += Vector3.new(0, 25, 0)
end
can answer how me check if part name equals KillBrick or it is a part because i idk how get each part but if use GetDescendants its returns array but not each part
:GetDescendants() returns an array will all descendants of the object
Like i said; move your killbricks to another folder named “KillBricks” and then call :GetChildren() – (not :GetDescendants())
That will give you every object in that folder. If you only put parts in that folder, you dont need to do any checks that would waste performance
if you were to call :GetChildren() on this screen gui, it would give you {MainFrame}
if you had another instance on the same level, you would get that too
Calling :GetDescendants() gives you EVERYTHING under the ScreenGui :