How to get all the children in a folder in roblox

I tried to do this but it’s doesn’t work
(all of them with the same name)

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Parent.Parent.Parent.Character:MoveTo(game.Workspace.Here.Position)
	local ValueParts = game.Workspace.Parkour:GetDescendants()
	ValueParts.CanTouch = true
	print("Done2")
end)
for _, v in pairs(workspace.Parkour:GetChildren()) do
v.CanTouch = true
end)
2 Likes

You have to loop through the Descendants of the folder as you’re given an array

for _, part in ipairs(ValueParts) do
   --Check if part IsA BasePart
   --Afterwards set part's CanTouch to true
end
2 Likes

payer solution work only one time then stop working

how to check if part IsA BasePart ?

For _, ValueParts in pairs (ValueParts) do

If ValueParts:IsA(“Part”) then
ValueParts.CanTouch =true
End

End

This should do it

1 Like

ty that work correctly

aaaaaaa

It’s best to do IsA("BasePart") as it will account for all parts that extend BasePart, wedges, Truss parts, MeshParts, etc. Checking for Part only checks for one type of part, so if @MONSTERGAMES3609 uses different kinds of parts like what I mentioned, it wont set CanTouch to them

for _, part in ipairs(ValueParts) do
	if not part:IsA("BasePart") then
		continue
	end
	part.CanTouch = true
end
1 Like

Didn’t know that basepart thing thanks!

1 Like