how to breakjoints lua code example

Example: how to breakjoints lua

local partA = script.Parent.PartA
local partB = script.Parent.PartB
 
local function join(part0, part1, jointClass, parent)
    local newJoint = Instance.new(jointClass or "ManualWeld")
    newJoint.Part0 = part0
    newJoint.Part1 = part1
    newJoint.C0 = CFrame.new()
    newJoint.C1 = part1.CFrame:toObjectSpace(part0.CFrame)
    newJoint.Parent = parent or part0
 
    return newJoint
end
 
-- Create some joints and break them
join(partA, partB)
partA:BreakJoints()
-- Glue joints are wobbly
join(partA, partB, "Glue")
partA:BreakJoints()
-- Most of the time, joints ought to be put in JointsService
join(partA, partB, "Weld", game:GetService("JointsService"))