jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
|
| 21 Jul 2017 04:05 PM |
when ever i run this script it keep getting this error: 16:37:04.823 - Parameter 2 must be BasePart in SetPartCollisionGroup.
PLEASE HELP
here's the script:
function collideModel(model,mode) local PhysicsService = game:GetService("PhysicsService") PhysicsService:CreateCollisionGroup("ModelCollision") PhysicsService:CreateCollisionGroup("CollisionPart") PhysicsService:CollisionGroupSetCollidable("ModelCollision", "CollisionPart", mode) for i,v in pairs (model:GetChildren()) do if v.ClassName == "Model" then collideModel(v) v.Transparency = 0.5 else PhysicsService:SetPartCollisionGroup(v, "ModelCollision") end end end nyan = script.Parent.PoptartBodySorted collideModel(nyan,false)
|
|
|
| Report Abuse |
|
|
VilgO
|
  |
| Joined: 15 Feb 2011 |
| Total Posts: 518 |
|
|
| 21 Jul 2017 04:28 PM |
| > Parameter 2 must be BasePart in SetPartCollisionGroup |
|
|
| Report Abuse |
|
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
|
| 21 Jul 2017 04:35 PM |
your just repeating what the error told me, can you give me an example?
|
|
|
| Report Abuse |
|
|
|
| 21 Jul 2017 04:37 PM |
Are you actually reading the error or are you just staring at it?
|
|
|
| Report Abuse |
|
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
|
| 21 Jul 2017 04:39 PM |
i am reading it and i did try to fix by switching the parameters
right here:
function collideModel(mode,model) local PhysicsService = game:GetService("PhysicsService") PhysicsService:CreateCollisionGroup("ModelCollision") PhysicsService:CreateCollisionGroup("CollisionPart") PhysicsService:CollisionGroupSetCollidable("ModelCollision", "CollisionPart", mode) for i,v in pairs (model:GetChildren()) do if v.ClassName == "Model" then collideModel(v) v.Transparency = 0.5 else PhysicsService:SetPartCollisionGroup(v, "ModelCollision") end end end nyan = script.Parent.PoptartBodySorted collideModel(false,nyan)
|
|
|
| Report Abuse |
|
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
|
| 21 Jul 2017 04:39 PM |
but it gives the same error
|
|
|
| Report Abuse |
|
|
|
| 21 Jul 2017 04:43 PM |
your function takes two parameters. In the middle of your function you call it for models inside models and forget to add the mode boolean.
|
|
|
| Report Abuse |
|
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
|
| 21 Jul 2017 04:47 PM |
can you show or add a "--" next to which line you are referring to?
|
|
|
| Report Abuse |
|
|
|
| 21 Jul 2017 04:51 PM |
function collideModel(mode,model) local PhysicsService = game:GetService("PhysicsService") PhysicsService:CreateCollisionGroup("ModelCollision") PhysicsService:CreateCollisionGroup("CollisionPart") PhysicsService:CollisionGroupSetCollidable("ModelCollision", "CollisionPart", mode) for i,v in pairs (model:GetChildren()) do if v.ClassName == "Model" then collideModel(v) --this line here v.Transparency = 0.5 else PhysicsService:SetPartCollisionGroup(v, "ModelCollision") end end end nyan = script.Parent.PoptartBodySorted collideModel(false,nyan)
|
|
|
| Report Abuse |
|
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
|
| 21 Jul 2017 04:56 PM |
i fixed it and i still got the same error: Parameter 2 must be BasePart in SetPartCollisionGroup.
heres the script
function collideModel(model,mode) local PhysicsService = game:GetService("PhysicsService") PhysicsService:CreateCollisionGroup("ModelCollision") PhysicsService:CreateCollisionGroup("CollisionPart") PhysicsService:CollisionGroupSetCollidable("ModelCollision", "CollisionPart", mode) for i,v in pairs (model:GetChildren()) do if v.ClassName == "Model" then collideModel(v,mode)-- i added it here v.Transparency = 0.5 else PhysicsService:SetPartCollisionGroup(v, "ModelCollision") end end end nyan = script.Parent.PoptartBodySorted collideModel(nyan,false)
|
|
|
| Report Abuse |
|
|
VilgO
|
  |
| Joined: 15 Feb 2011 |
| Total Posts: 518 |
|
|
| 21 Jul 2017 05:01 PM |
| Please find the only line in your code that has a SetPartCollisionGroup function in it. |
|
|
| Report Abuse |
|
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
|
| 21 Jul 2017 05:04 PM |
once again i added it there too and i'm still getting the same error
function collideModel(model,mode) local PhysicsService = game:GetService("PhysicsService") PhysicsService:CreateCollisionGroup("ModelCollision") PhysicsService:CreateCollisionGroup("CollisionPart") PhysicsService:CollisionGroupSetCollidable("ModelCollision", "CollisionPart", mode) for i,v in pairs (model:GetChildren()) do if v.ClassName == "Model" then collideModel(v,mode)-- i added it here v.Transparency = 0.5 else PhysicsService:SetPartCollisionGroup(v, "ModelCollision",mode) -- and here end end end nyan = script.Parent.PoptartBodySorted collideModel(nyan,false)
|
|
|
| Report Abuse |
|
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
| |
|
|
| 21 Jul 2017 05:14 PM |
I think the problem is that 'v' is not a base part. Look for something inside your model (nyan) that is not a base part and add an exception in your script.
|
|
|
| Report Abuse |
|
|
VilgO
|
  |
| Joined: 15 Feb 2011 |
| Total Posts: 518 |
|
|
| 21 Jul 2017 05:30 PM |
| That's exactly what the error message says :\ |
|
|
| Report Abuse |
|
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
|
| 21 Jul 2017 05:31 PM |
but v is the part or child of nyan
|
|
|
| Report Abuse |
|
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
| |
|
|
| 21 Jul 2017 05:55 PM |
Look at the error: Parameter 2 must be BasePart in SetPartCollisionGroup. Now look at the line is is clearly referring to: PhysicsService:SetPartCollisionGroup(v, "ModelCollision")
Now think. "ModelCollision" is a string, not a BasePart. There is your problem. |
|
|
| Report Abuse |
|
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
|
| 21 Jul 2017 05:58 PM |
OMG CAN YOU NOT READ
PhysicsService:SetPartCollisionGroup(v, "ModelCollision",mode) -- YOU MISSED THIS PART
|
|
|
| Report Abuse |
|
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
|
| 21 Jul 2017 06:10 PM |
(bump) i've literally been on the forums my hold day, and no one has given me the awnser
|
|
|
| Report Abuse |
|
|
|
| 21 Jul 2017 06:14 PM |
remove that boolean parameter, and add a check after the else: if v:IsA("BasePart") then |
|
|
| Report Abuse |
|
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
|
| 21 Jul 2017 06:17 PM |
you're not being specific enough
|
|
|
| Report Abuse |
|
|
|
| 21 Jul 2017 06:23 PM |
function collideModel(model,mode) local PhysicsService = game:GetService("PhysicsService") PhysicsService:CreateCollisionGroup("ModelCollision") PhysicsService:CreateCollisionGroup("CollisionPart") PhysicsService:CollisionGroupSetCollidable("ModelCollision", "CollisionPart", mode) for i,v in pairs (model:GetChildren()) do if v.ClassName == "Model" then collideModel(v,mode) else if v:IsA("BasePart") then PhysicsService:SetPartCollisionGroup(v, "ModelCollision") end end end end nyan = script.Parent.PoptartBodySorted collideModel(nyan,false) |
|
|
| Report Abuse |
|
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
| |
|
jojo8764
|
  |
| Joined: 27 Nov 2012 |
| Total Posts: 1239 |
|
| |
|