I've been trying to make some constraint levers work for a few days now, they work fine and all except for the fact that the welding screws up and offsets the parts. (Screenshot below)
prntscr.com/dptvyp
Primary Weld Code
-- | Welds levers | --
Weld.WeldLever = function(Lever,CS,AS) -- Lever Model, Constraint Settings, Attachment Settings
local Hinge = Constrain.Hinge(Lever,"Constraint",CS.LimitsEnabled,CS.UpperAngle,CS.LowerAngle,CS.Restitution,CS.ActuatorType,CS.AngularSpeed,CS.ServoMaxTorque,CS.TargetAngle)
local A0 = Constrain.Attach(Lever.Joint0,Lever.Name.."Joint",AS.Position0,AS.Rotation0)
local A1 = Constrain.Attach(Lever.Joint1,Lever.Name.."Joint",AS.Position1,AS.Rotation1)
Hinge.Attachment0 = A0
Hinge.Attachment1 = A1
for i,p in next,(Lever:GetChildren()) do
if (p.Name ~= "Joint0") and (p.Name ~= "Joint1") and (p:IsA("BasePart")) then
Weld.NewWeld(Lever.Joint1,p,Lever.Joint1,p.Name.."Weld")
end;
end;
for i,p in next,(Lever:GetChildren()) do
if (p.Name ~= "Joint0") and (p:IsA("BasePart")) then
p.Anchored = false
p.CanCollide = false
end;
end;
end;
Weld Generator :
-- | Creates new Welds | --
Weld.NewWeld = function(p0,p1,Parent,Name)
local w = Instance.new("Weld")
w.Part0,w.Part1 = p0,p1
w.C0 = p0.CFrame:inverse()
w.C1 = p1.CFrame:inverse()
w.Parent = Parent
w.Name = Name
return w
end;
Constraint Service :
Strain.Hinge = function(Parent,Name,LE,UA,LA,Rest,AT,Ang,Tor,TAMA) --Parent, Name (String), Limits Enabled (Boolean), Upper Angle (Int), Lower Angle (Int), Restitution (Int), Actuator Type (String[Servo,Motor or None]), Angular (Int[Angular Speed/Angular Velocity]), Max Torque (Int), Target Angle/Max Acceleration (Int)
local Hinge = Instance.new("HingeConstraint")
Hinge.Parent = Parent
Hinge.Name = Name
if LE then
Hinge.LimitsEnabled = true
Hinge.UpperAngle = UA
Hinge.LowerAngle = LA
Hinge.Restitution = Rest
end
if AT == "Motor" then
Hinge.ActuatorType = Enum.ActuatorType.Motor
Hinge.AngularVelocity = Ang
Hinge.MotorMaxTorque = Tor
Hinge.MotorMaxAcceleration = TAMA
elseif AT == "Servo" then
Hinge.ActuatorType = Enum.ActuatorType.Servo
Hinge.AngularSpeed = Ang
Hinge.ServoMaxTorque = Tor
Hinge.TargetAngle = TAMA
else
Hinge.ActuatorType = Enum.ActuatorType.None
end
return Hinge
end;
Help is greatly appreciated!

9 comments
"Screenshot Below"?
Forgot it lol, just posed it
Id suggest putting these 3 parts in a model, with an invisible part over it that is 2ce the length towards the center, so that you can use model:SetPrimaryPartCFrame()
They're already in a model, I dont think you're understanding my code. This code sets up a lever model for constraint movement.
https://gyazo.com/b4a8eb2477f051de54b73de1a1f078e0 Something like this. Red part being the invisible part, green part being your lever-holder, black parts being the visible lever
https://www.roblox.com/games/538077004/TARDIS-Gamma-REWRITE#!/game-instances, It would be easier for me to explain in game as to what my problem is.
No acces
Making public.
http://prntscr.com/dpu67f