local part = script.Parent
part.CanCollide = true
local function onTouch(otherPart)
local character = otherPart.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
otherPart.CanCollide = false
else
otherPart.CanCollide = true
end
end
local function onTouchEnded(otherPart)
local character = otherPart.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
otherPart.CanCollide = true
end
end
part.Touched:Connect(onTouch)
part.TouchEnded:Connect(onTouchEnded)