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: MY SCRIPT KEEPS GETTING AN ERROR

Previous Thread :: Next Thread 
jojo8764 is not online. 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 is not online. VilgO
Joined: 15 Feb 2011
Total Posts: 518
21 Jul 2017 04:28 PM
> Parameter 2 must be BasePart in SetPartCollisionGroup
Report Abuse
jojo8764 is not online. 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
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
21 Jul 2017 04:37 PM
Are you actually reading the error or are you just staring at it?


Report Abuse
jojo8764 is not online. 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 is not online. jojo8764
Joined: 27 Nov 2012
Total Posts: 1239
21 Jul 2017 04:39 PM
but it gives the same error


Report Abuse
bigboy77584 is online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
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 is not online. 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
bigboy77584 is online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
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 is not online. 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 is not online. 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 is not online. 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 is not online. jojo8764
Joined: 27 Nov 2012
Total Posts: 1239
21 Jul 2017 05:13 PM
BUMP I REALLY NEED HELP


Report Abuse
bigboy77584 is online. bigboy77584
Joined: 06 Jan 2009
Total Posts: 1003
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 is not online. 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 is not online. 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 is not online. jojo8764
Joined: 27 Nov 2012
Total Posts: 1239
21 Jul 2017 05:50 PM
bump (i need help)


Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
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 is not online. 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 is not online. 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
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
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 is not online. jojo8764
Joined: 27 Nov 2012
Total Posts: 1239
21 Jul 2017 06:17 PM
you're not being specific enough


Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
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 is not online. jojo8764
Joined: 27 Nov 2012
Total Posts: 1239
21 Jul 2017 06:28 PM
ok lemme see


Report Abuse
jojo8764 is not online. jojo8764
Joined: 27 Nov 2012
Total Posts: 1239
21 Jul 2017 06:33 PM
hmmmmmmmmmmmmmmmm


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