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

How do you anchor tons of groups with a script?

I've been working for so long on a new map spawning in a lot of pine trees. After all my work I noticed the objects in the pine trees weren't anchored I made a group of all the pine trees called "PineTrees" inside there I put a normal script to try to anchor all the objects in the groups. It ended up throwing the error "GetDescendant is not a valid member of Model". Here's the script:

local model = script.Parent
	local childs = model:GetDescendant() 
for I,v in pairs(childs) do 
    if v:IsA("BasePart") then 
        v.Anchored = true
    end
end

2 answers

✓ Accepted answer

You are missing an "s" on your :GetDescendants()

2 comments

0

Thanks!

0

Np! Accept my answer if it helped!

I believe the function you are looking for is :GetChildren() It will find all the children.

2 comments

1

GetDescendants() works and thats why his isnt. Hes missing an s

0

Oh, good to know! Thanks.

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