I need help. Basically, I need to check if every part in a model is anchored, if it’s not loop back until it is. Once it is run something else.
I was thinking a repeat until loop or a for loop but I didn’t know how to go around to there. I’m new to scripting kinda, so forgive me if it’s clear as day.
local foundUnAnchored = true
while foundUnAnchored == true do
foundUnAnchored = false
for i,v in pairs(model:GetDescendants()) do
if v:IsA("BasePart") then
if v.Anchored == false then
foundUnAnchored = true
end
end
end
end
print("everything anchored")
theres prob another method but this is the one I thought of
local Workspace = workspace
local Model = Workspace.Model
for _, Child in ipairs(Model:GetDescendants()) do
if not (Child:IsA("BasePart")) then continue end
if not Child.Anchored then continue end
print(Child.Name) --First anchored child.
end