function OrientableBody.useAttributeAsSource(f)f:orientFromAttribute()f.attributeConnection=(f.character:GetAttributeChangedSignal(ATTRIBUTE)):Connect(function()f:orientFromAttribute()end)end function OrientableBody.destroy(f)f:applyAngle(f.neck,0,0)f:applyAngle(f.waist,0,0)if f.motor then f.motor:destroy()f.motor=nil end if f.attributeConnection then f.attributeConnection:Disconnect()f.attributeConnection=nil end if f.renderStepConnection then f.renderStepConnection:Disconnect()f.renderStepConnection=nil end end return OrientableBody
-- Use the character attribute (updated by the server) as the source of truth for body orientation
-- Intended to be used for replicated characters
function OrientableBody:useAttributeAsSource()
	self:orientFromAttribute()
	self.attributeConnection = self.character:GetAttributeChangedSignal(ATTRIBUTE):Connect(function()
		self:orientFromAttribute()
	end)
end

function OrientableBody:destroy()
	self:applyAngle(self.neck, 0, 0)
	self:applyAngle(self.waist, 0, 0)

	if self.motor then
		self.motor:destroy()
		self.motor = nil
	end
	if self.attributeConnection then
		self.attributeConnection:Disconnect()
		self.attributeConnection = nil
	end
	if self.renderStepConnection then
		self.renderStepConnection:Disconnect()
		self.renderStepConnection = nil
	end
end

return OrientableBody
