Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you check if an object is a model or a BasePart?

I need to know this to determine the position of said object, if possible.

1 answer

✓ Accepted answer

You can use the IsA method of instances to check if they are a part of a class. For example, if you wanted to get the CFrame of the part or model, you could do:

local function GetCFrame(Inst)
    if Inst:IsA("BasePart") then
		return Inst.CFrame
	elseif Inst:IsA("Model") then
		return Inst:GetPrimaryPartCFrame()
	end
end

1 comment

0

Thank you so much!

This discussion is preserved as it was. New answers, comments, and votes are closed.