local PhysicsService = game:GetService("PhysicsService")
-- List of body parts you want to affect (works for both R6 and R15)
local allowedParts = {
"Head", "Torso", "Left Arm", "Right Arm", "Left Leg", "Right Leg", -- R6
"UpperTorso", "LowerTorso", "LeftUpperArm", "LeftLowerArm", "LeftHand",
"RightUpperArm", "RightLowerArm", "RightHand",
"LeftUpperLeg", "LeftLowerLeg", "LeftFoot",
"RightUpperLeg", "RightLowerLeg", "RightFoot" -- R15
}
local function isTargetPart(name)
for _, partName in ipairs(allowedParts) do
if name == partName then
return true
end
end
return false
end
script.Parent.Touched:Connect(function(part)
local character = part:FindFirstAncestorOfClass("Model")
if not character then return end
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if not humanoid then return end
-- Set selected body parts to the "buffer" collision group
for _, child in ipairs(character:GetChildren()) do
if child:IsA("BasePart") and isTargetPart(child.Name) then
PhysicsService:SetPartCollisionGroup(child, "buffer")
end
end
task.wait(1)
-- Reset back to "Default"
for _, child in ipairs(character:GetChildren()) do
if child:IsA("BasePart") and isTargetPart(child.Name) then
PhysicsService:SetPartCollisionGroup(child, "Default")
end
end
end)