I’m trying to make a gui for a truck and the buttons that I intended to do a certain function do the opposite of what I want. Here’s a picture of the GUI in the workspace.

Here’s another picture of the arm in the workspace. The ObjectValue is attached to the highlight. 
Now here’s the code.
truck = script.Parent.Value.Value
Frame = script.Parent.Toggle
Frame1 = script.Parent.Toggle1
Frame2 = script.Parent.Toggle2
Frame3 = script.Parent.Toggle3
Frame4 = script.Parent.Toggle4
Frame5 = script.Parent.Toggle5
--ARM FUNCTION
gui.A1.MouseButton1Down:Connect(function()
if Frame.Visible == true then
Frame.Visible = false
truck.Arm.A1.HingeConstraint.AngularVelocity = -3
truck.Arm.A2.HingeConstraint.AngularVelocity = 3
elseif Frame.Visible == false then
Frame.Visible = true
truck.Arm.A1.HingeConstraint.AngularVelocity = 0
truck.Arm.A2.HingeConstraint.AngularVelocity = 0
end
end)
gui.A2.MouseButton1Down:Connect(function()
if Frame1.Visible == true then
Frame1.Visible = false
truck.Arm.A1.HingeConstraint.AngularVelocity = 3
truck.Arm.A2.HingeConstraint.AngularVelocity = -3
elseif Frame1.Visible == false then
Frame1.Visible = true
truck.Arm.A1.HingeConstraint.AngularVelocity = 0
truck.Arm.A2.HingeConstraint.AngularVelocity = 0
end
end)
gui.E2.MouseButton1Down:Connect(function()
if Frame2.Visible == true then
Frame2.Visible = false
truck.Arm.Motor.HingeConstraint.AngularVelocity = 1
truck.Arm.Motor.HingeConstraint.UpperAngle = 40
elseif Frame2.Visible == false then
Frame2.Visible = true
truck.Arm.Motor.HingeConstraint.AngularVelocity = 0
truck.Arm.Motor.HingeConstraint.UpperAngle = 40
end
end)
gui.E1.MouseButton1Down:Connect(function()
if Frame3.Visible == true then
Frame3.Visible = false
truck.Arm.Motor.HingeConstraint.AngularVelocity = -1
truck.Arm.Motor.HingeConstraint.UpperAngle = 40
elseif Frame3.Visible == false then
Frame3.Visible = true
truck.Arm.Motor.HingeConstraint.AngularVelocity = 0
truck.Arm.Motor.HingeConstraint.UpperAngle = 40
end
end)
gui.U1.MouseButton1Down:Connect(function()
if Frame4.Visible == true then
Frame4.Visible = false
truck.Arm.Motor.HingeConstraint.AngularVelocity = -2
truck.Arm.Motor.HingeConstraint.UpperAngle = 180
elseif Frame4.Visible == false then
Frame4.Visible = true
truck.Arm.Motor.HingeConstraint.AngularVelocity = 0
truck.Arm.Motor.HingeConstraint.UpperAngle = 180
end
end)
gui.U2.MouseButton1Down:Connect(function()
if Frame4.Visible == true then
Frame4.Visible = false
truck.Arm.Motor.HingeConstraint.AngularVelocity = 2
truck.Arm.Motor.HingeConstraint.UpperAngle = 180
elseif Frame4.Visible == false then
Frame4.Visible = true
truck.Arm.Motor.HingeConstraint.AngularVelocity = 0
truck.Arm.Motor.HingeConstraint.UpperAngle = 180
end
end)
The problem I’m having is that button “A1” does the function that button “A2” is supposed to do. Button “E1” does the function of “E2” and vice versa. Buttons “E1” and “E2” also don’t change the UpperAngle of the hinge. Buttons “U1” and “U2” just don’t work at all.