PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

BreakJoints

Breaks connections between BaseParts, including surface connections with any adjacent parts, WeldConstraints, and all Welds and other JointInstances.

When BreakJoints is used on a Player character Model, the character’s Humanoid will die as it relies on the Neck joint.

Note that although joints produced by surface connections with adjacent Parts can technically be recreated using Model/MakeJoints, this will only recreate joints produced by surfaces. Developers should not rely on this as following the joints being broken parts may no longer be in contact with each other.

Returns

Return Type Summary

Code Samples


Manual Joint Creation

This code sample demonstrates manual creation of joints on two parts that are siblings of the script (PartA and PartB). It creates a joints on two touching parts with compatible surface types (Studs and Inlet).

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"))

Break Character Joints

In this sample the joints in every Player character Model added will be broken 3 seconds after spawning. Breaking these joints will cause the Humanoid to die.

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(newPlayer)
	newPlayer.CharacterAdded:Connect(function(characterModel)
		wait(3)
		characterModel:BreakJoints()
	end)
end)