|
| 22 Jul 2015 07:10 PM |
| type(v) only returns userdata, so what is the correct function for this, I forget :( |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
| |
|
|
| 22 Jul 2015 07:14 PM |
IsA is not a valid member
error :/ |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 22 Jul 2015 07:19 PM |
| And how would I check if it is an instance? |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 15 Sep 2010 |
| Total Posts: 2588 |
|
|
| 22 Jul 2015 07:26 PM |
Please paste in your for loop.
Said the wise. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|