How to make a character body part collidable?

I am destroying Motor6D so the body part which is v would fall off as I am making a cutting limbs system. I heard about setting CanCollide to True each frame and I think that’s just what I did.

Snippet:

for _, motor6d in ipairs(character.Torso:GetChildren()) do
	if motor6d:IsA("Motor6D") then
		if motor6d.Part1 == v then
			motor6d:Destroy()

			RunSerivce.Stepped:Connect(function()
				v.CanCollide = true
			end)
		end
	end
end

What does “v” return? thrty chrctrs

A body part of a character. thrty chrctrs

Hmm, I don’t see why would you need to set it to cancollide each frame, simply, just do something like:
Character.Torso.CanCollide = true
That does it for me

2 Likes

Apparently, Humanoid automatically sets body part’s CanCollide to false every frame.

1 Like

I don’t think you can bypass that by setting it to true every frame, it would be just a battle between both with no result and/or end.

Consider reading the article that @Seuika posted. It is the solution to what you’re looking for.

2 Likes

You can’t change body collision with Part.CanCollide. Check out article I posted.

1 Like

I did this but it still going through the floor.

Setting PhysicsService:

local PhysicsService = game:GetService("PhysicsService")

PhysicsService:CreateCollisionGroup("Cut")
PhysicsService:CollisionGroupSetCollidable("Cut", "Cut", true)

Snippet:

for _, motor6d in ipairs(character.Torso:GetChildren()) do
	if motor6d:IsA("Motor6D") then
		if motor6d.Part1 == v then
			motor6d:Destroy()

			PhysicsService:SetPartCollisionGroup(v, "Cut")
		end
	end
end
Whole Script:

local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local PhysicsService = game:GetService(“PhysicsService”)

PhysicsService:CreateCollisionGroup(“Cut”)
PhysicsService:CollisionGroupSetCollidable(“Cut”, “Cut”, true)

local random = Random.new()

ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player, front, damage)
print(damage)

local character = player.Character

local region = Region3.new(front - Vector3.new(2, 2, 2), front + Vector3.new(2, 2, 2))

----------[ VISUALS ]---------

local part = Instance.new("Part")
part.CFrame = region.CFrame
part.Size = region.Size
part.Anchored = true
part.CanCollide = false
part.Transparency = 0.5
part.Parent = workspace

game:GetService("Debris"):AddItem(part, 0.1)

----------[ VISUALS ]---------

for _, v in ipairs(workspace:FindPartsInRegion3(region, player.Character, 1)) do
	local character = v.Parent
	local humanoid = character:FindFirstChild("Humanoid")
	
	if humanoid then
		humanoid:TakeDamage(damage)
		
		local hitSounds = character.HitSounds:GetChildren()
		local hitSound = hitSounds[math.random(#hitSounds)]
		
		hitSound.Volume = damage / 200 -- oh yea baby
		hitSound:Play()
		
		for _, motor6d in ipairs(character.Torso:GetChildren()) do
			if motor6d:IsA("Motor6D") then
				if motor6d.Part1 == v then
					motor6d:Destroy()
					
					PhysicsService:SetPartCollisionGroup(v, "Cut")
				end
			end
		end
	end
end

end)

How is it? Can you show a screen shoot of it?

you must create a part inside the bodypart that`s being cut and make it collidable

	function cpart(p)
	local rp = Instance.new("Part")
	rp.Name = "colpart"
	rp.Size = p.Size/1.4
	rp.Massless = true 				
	rp.CFrame = p.CFrame 
	rp.Transparency = 1
	rp.Parent = p
	local wc = Instance.new("WeldConstraint",rp)
	wc.Part0 = rp 
	wc.Part1 = p 
	end 

for _, motor6d in ipairs(character.Torso:GetChildren()) do
	if motor6d:IsA("Motor6D") then
		if motor6d.Part1 == v then
             cpart(motor6d.Part1)
			motor6d:Destroy()
		end
	end
end
5 Likes

That’s the hacky way but it gets the job done so I guess I’ll set this as the solution.