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
You should not need any variables in this function. Explanations are in the script. If you have questions, feel free to comment on this answer.
function onTouched(hit) if hit.Parent:FindFirstChild("Humanoid") then -- if a humanoid exists, then print("Don't break those joints!") --Just to prove it works when a humanoid hits it and doesn't die. else hit:BreakJoints() --Hit is a part. If "hit" hit's the brick you're putting this script in, then "hit" will break joints. end end script.Parent.Touched:connect(onTouched)