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 » Scripters
Home Search
 

Re: How to know if something is a BasePart

Previous Thread :: Next Thread 
darkemosoul is not online. darkemosoul
Joined: 13 Dec 2008
Total Posts: 458
22 Jul 2015 07:10 PM
type(v) only returns userdata, so what is the correct function for this, I forget :(
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
22 Jul 2015 07:12 PM
if v:IsA("BasePart")
Report Abuse
darkemosoul is not online. darkemosoul
Joined: 13 Dec 2008
Total Posts: 458
22 Jul 2015 07:14 PM
IsA is not a valid member

error :/
Report Abuse
igunaa is not online. igunaa
Joined: 15 Sep 2010
Total Posts: 2588
22 Jul 2015 07:16 PM
Check if you wrote .IsA instead of :IsA ( : is the right one.)


Said the wise.
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
22 Jul 2015 07:17 PM
Make sure 'v' is an actual instance


I don't need a siggy
Report Abuse
darkemosoul is not online. darkemosoul
Joined: 13 Dec 2008
Total Posts: 458
22 Jul 2015 07:18 PM
Ok let me explain,

a function checks if it is a vector3 value or a BasePart. I am doing this so that if it is a BasePart it will update the position every tick. But the problem is how do I check if it is a vector3 or a BasePart.
Report Abuse
darkemosoul is not online. darkemosoul
Joined: 13 Dec 2008
Total Posts: 458
22 Jul 2015 07:19 PM
And how would I check if it is an instance?
Report Abuse
igunaa is not online. igunaa
Joined: 15 Sep 2010
Total Posts: 2588
22 Jul 2015 07:20 PM
Well, BaseParts got Positions, and those can be set in Vector3 values I guess.

You need to check inside the model you`re looking for BaseParts, not Vector3 values.


Said the wise.
Report Abuse
darkemosoul is not online. darkemosoul
Joined: 13 Dec 2008
Total Posts: 458
22 Jul 2015 07:25 PM
I know BaseParts have positions,


If I send a request to an entity to Move, I either have it move to a coordinates or Follow a Parts position. What I can't however distinguish is if they sent me a Vec3 or a Part. Now I guess I have no choice but to change the entire function because apparently there is no way to check whether the value that was sent was a Vector3 class or a BasePart class.

I know I can do this easy the problem is, I don't know how to check the Class of each object because I don't know how Roblox has written them.


Are you telling me there is no way for me to detect what type of Class was sent?
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
22 Jul 2015 07:25 PM
"And how would I check if it is an instance?"

if v:IsA("Instance")

http://wiki.roblox.com/index.php?title=IsA
Report Abuse
igunaa is not online. igunaa
Joined: 15 Sep 2010
Total Posts: 2588
22 Jul 2015 07:26 PM
Please paste in your for loop.


Said the wise.
Report Abuse
darkemosoul is not online. darkemosoul
Joined: 13 Dec 2008
Total Posts: 458
22 Jul 2015 07:29 PM
BUT when they send a Vector3 instead of a part


"IsA is not a valid member"


17:27:47.980 - IsA is not a valid member
17:27:47.981 - Script 'ServerStorage.resource.Modules.mod_gfmgr.data.system', Line 53 - method update
17:27:47.981 - Script 'ServerStorage.resource.Modules.mod_entity.data.engine', Line 157 - method update
17:27:47.982 - Script 'ServerScriptService.Server.plugins.plug_egmgr', Line 41
17:27:47.983 - Stack End


Would you like the script to?

print(Position:IsA("BasePart")) -- Line 53
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
22 Jul 2015 07:30 PM


local isAPart = pcall(function() local err = v:IsA("BasePart") if(not err)then error() end end)

if(isAVec3)then --must be a basepart

end
if(not isAVec3)then --must be something else

end
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
22 Jul 2015 07:34 PM
use pcall
local success = pcall(function() Position:IsA("BasePart") end)
if success then
-- is a basepart
else
-- wont error if it is a vector3
end
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
22 Jul 2015 07:35 PM
this is what i get for not refreshing the page and checking the wiki to proof-read my snippet

floodcheck pls
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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