Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you anchor tons of groups with a script?

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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

0
Thanks! strangejmaster43 139 — 4y
0
Np! Accept my answer if it helped! Brandon1881 721 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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

1
GetDescendants() works and thats why his isnt. Hes missing an s MrCatDoggo 213 — 4y
0
Oh, good to know! Thanks. JailBreaker_13 350 — 4y

Answer this question