I was trying to make a script to know which part is a model using the Instance:IsA() function and if it’s a model and the name is “Parts” then it finds a script that’s inside the model to enable it. The only problem is that it would throw me an error:
Workspace.TheWorldIsAboutToEnd.Part.MainScript:12: attempt to call a nil value
Here is the location of the objects:
And here is the script:
local children = script.Parent.Parent.Parent:GetChildren()
for i,v in pairs(children) do
if children:IsA("Model") and children.Name = "Parts" then
children.CreatePart.Disabled = false
end
end
local children = script.Parent.Parent.Parent:GetChildren()
for i,v in pairs(children) do
if v:IsA("Model") and v.Name = "Parts" then
v.CreatePart.Disabled = false --Idk what this does.
end
end
Fixed your code because you are trying to get the information of a table which is the GetChildren() instead of a children of it.