local breakjoints = true
function onTouched(hit)
if (breakjoints == true) then
wait(1)
hit:BreakJoints()
end
local humanoid = hit:FindFirstChild("Humanoid")
if (humanoid ~= nil) then -- if a humanoid exists, then
breakjoints = false
else breakjoints = true
end
end
connection = script.Parent.Touched:connect(onTouched)
Breaks joints even if it is a humanoid, not supposed to do that

2 comments
Are you just wanting to kill the Character, or are you trying to destroy everything but the character? Your code and explanation are kind of confusing and broad.
Oh, now I see your title. Alright, just wait for my FloodCheck on answering to lift...