Let me explain my question.We have Part A, B, and C. What I wanted to do is that Part B is non-CanCollide to Part A only while it can collide with Part C. I am new to scripting and I can't make up my own script.
✓ ANSWER ACCEPTED
How do I make a Part non-CanCollide to a part only through scripting?
2 answers
✓ Accepted answer
You will need PhysicService for that
https://developer.roblox.com/en-us/api-reference/class/PhysicsService
What this does is basically allows you to create groups and set their rules
example :
local PartA = --Part A here
local PartB = --Part B here
local PartC = --Part C here
local PhysicService = game:GetService("PhysicsService")
--That will call the service that will provide us with the functions that we need
PhysicService:CreateCollisionGroup("GroupA")
PhysicService:CreateCollisionGroup("GroupB")
PhysicService:CreateCollisionGroup("GroupC")
--This will create collision group which we can put multiple objects in
PhysicService:CollisionGroupSetCollideable("GroupA", "GroupB", false)
--This will set a rule, any object that is set to "GroupA" cannot collide with "GroupB"
PhysicService:CollisionGroupSetCollideable("GroupB", "GroupC", false)
--This will set a rule, any object that is set to "GroupB" cannot collide with "GroupC"
PhysicService:SetPartCollisionGroup(PartA, "GroupA")
PhysicService:SetPartCollisionGroup(PartB, "GroupB")
PhysicService:SetPartCollisionGroup(PartC, "GroupC")
--This will set all the part into a collision group
--The end result of that script will be :
--- PartA cannot collide with PartB, but can collide with PartC
--- PartB cannot collide with PartC and PartA
--- PartC cannot collide with PartB, but can collide with PartA
--Hopefully that explanation is detailed and simple enough
1 comment
0
Np
game.Workspace.Part.Cancollid = true
2 comments
0
CanColide is a bool value here game.Workspace.Part.Cancollid = true
0
that wasn't useful, I already know about that script, do you have a script about collision groups?
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
do you know how to script?
I know how the basics.
I am talking about how a part can and cannot collide with other parts
just turn off cancollide in part a?
Just look at the cars in electric state RP, the wheels can collide with the ground while it cannot collide with the cars' body, but the cars' body has enabled can collide.