The question pretty much sums up: How to check if a model is a child of another model, with a server script?
Thanks for the Help!
The question pretty much sums up: How to check if a model is a child of another model, with a server script?
Thanks for the Help!
You can use the IsA class identifier metamethod. This allows you to pass an Instance through a conditional statement asking to compare it, or it's parent in this case' class type. Virtually, this can act as a form of verifying whether a certain Object is a child, of a specific Instance.
local myModel = workspace.Model
if (myModel.Parent:IsA("Model")) then
print(myModel.Name.." Is a child of "..myModel.Parent.Name.."!")
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
you could try if script.Parent.ClassName == "Model"l then...Code...end