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
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
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”)
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
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