Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I find the references by my self?

Asked by
net_h 13
4 years ago

if i for exampled wanted the game to check if an object is a Part what is the reference for it? like for example if X is a part then print 'it's a part'

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Use IsA

local X = Instance.new('Part')

if X:IsA('Part') then
    print("Congrats it's a part")
end

The IsA('Part') return true just if the object is a part, otherwise it's return false. So if you want that return true when you print with a meshpart instance or other basepart, just use "BasePart" like that

print(X:IsA('BasePart')) -- return true if is a Part/ MeshPart/ WedgePart/ ect...

IsA work with the ClassName of the Instance, to know what's the ClassName of your Instance, check in this properties.

Ad

Answer this question