I have the following code creating NoCollisionConstraints (NCC) so that the two character models not collide with eachother:
local limbs = {"HumanoidRootPart", "Left Arm", "Left Leg", "Right Arm", "Right Leg", "Torso", "Head"}
local char = ... -- Character 1
local eChar = ... -- Character 2
local att = ... -- Just some parent for the NCCs
local weld
for i, v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
for count = 1, #limbs do
weld = Instance.new("NoCollisionConstraint")
weld.Part0 = v
weld.Part1 = eChar[limbs[count]]
weld.Parent = att
end
end
end
As far as I know, that code makes all the NCCs necessary to make sure all the BaseParts in both the character models not collide with eachother. The problem is that it acts as if some parts still collide with eachother, here is a clip clarifying the problem:
In the clip I am jumping but the player I am carrying is not blocking my jump, meaning its somehow colliding with the player carrying.
Here is how “it should look like”:
In that clip I used collision groups, I don’t want to use the latter because it will get messy trying to manage all of them in a server.
Any ideas to what the problem might be? I might as well mention that the player carrying is in a different collision group to the player getting carried.
Why not try using a double for loop through descendants to make sure you get every part?
for _, part0 in pairs(char:GetDescendants()) do
for _, part1 in pairs(eChar:GetDescendants()) do
if
part0:IsA("BasePart") and part1:IsA("BasePart")
and part0.CanCollide and part1.CanCollide -- they would collide with each other
then
local constraint = Instance.new("NoCollisionConstraint")
constraint.Part0 = part0
constraint.Part1 = part1
constraint.Parent = att
end
end
end
This would in theory account for accessory parts, but I don’t really think they would have CanCollide true. You should also try printing all the parts that were filtered through and creating a new limbs array from that.
You could also try making all the parts in the carried character Massless = true until they stop getting carried.
I tried a double loop just to insure every BasePart is getting in the mix, but I am still running into that problem. I also can’t just set CanCollide to true or false because these are humanoid characters, their collidibility is dependent on their HumanoidStateType, it also isn’t a mass problem, if it was, i’d still be stuck here.
More of a workaround than a fix, but I’ll opt to using Collision Groups, I just put the player getting carried in another collision group that doesnt collide with the person carrying.