Skip to content

TypeScript code snippet – 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"))
See also  How to read file in Java jacakson?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.