generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How to Check Instance Type

Previous Thread :: Next Thread 
lewisw60 is not online. lewisw60
Joined: 27 Nov 2008
Total Posts: 193
03 May 2014 01:41 PM
How would I check whether or not say, an object was a script, a part, or a tool?
Report Abuse
samy22 is not online. samy22
Joined: 28 Sep 2008
Total Posts: 2181
03 May 2014 01:56 PM
http://wiki.roblox.com/index.php/API:Instance/ClassName

if child.className == "Part" then
-- will find Parts, but NOT TrussParts, WedgeParts, and other part-like objects
end


if child.className == "Script" then

end

if child.className == "Tool" then

end
Report Abuse
lewisw60 is not online. lewisw60
Joined: 27 Nov 2008
Total Posts: 193
03 May 2014 01:56 PM
Thank yew <3
Report Abuse
HeavenlyRobloxrox3 is not online. HeavenlyRobloxrox3
Joined: 02 May 2012
Total Posts: 101
03 May 2014 02:04 PM
Or you could just do:

if instance:IsA("Script") or instance:IsA("Part") or instance:IsA("Tool") then
do stuff
end
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
03 May 2014 02:23 PM
I highly recommend using the IsA method over checking the ClassName, because you can use superclasses such as BasePart.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image