if you try to use IsA on the workspace, it determines that its a model, is this intentional?
if you use this codeblock in a script, IsA returns that the workspace is a model.
if workspace:IsA("Model") then print "workspace" end
I’m trying to use IsA() to determine if a part’s parent is a model, except its returning that it is everytime cause its parented to the workspace, though the workspace is not a model?
maybe just do something like this?
if part.Parent:IsA("Model) and part.Parent.Name ~= "Workspace" then print("yes") end
i know i could do that, but i just want to know why IsA() by itself doesnt work
I’d assume it’s because the Workspace is a sort of model that contains all of the in-game parts. It’s gotta be something, y’know.
The Workspace class inherits from the Model Class, therefore, it is also a “model”.
You can simply check if something is a model and not workspace:
if something:IsA("Model") and not something:IsA("Workspace") then
--Code here
end
If you go to the Workspace documentation, you can see a section called Inherited from Model.
1 Like
thx for explanation i genuinely did not get why workspace would be considered a model

if you want to know if something is of a specific class without taking inheritance into account then use object.ClassName == "Model"
1 Like