Issue with code (if then) not working properly

Hello, I wanted to do a switch that goes from Hinge 0 to Hinge 50 then to Hinge -50 and then back to Hinge 0. But it doesnt work because it goes Hinge 0 to Hinge 50 to Hinge - 50 and then to 50 and -50 in a loop;

robloxapp-20220201-0040206.wmv (122.1 KB)

local hinge = script.Parent.Hinge.Attachment.HingeConstraint
local clickdetector = script.Parent.Model.Main.ClickDetector


clickdetector.MouseClick:Connect(function()
	
	if hinge.TargetAngle == 0 then
		hinge.TargetAngle = 50
	end
	
end)

clickdetector.MouseClick:Connect(function()

	if hinge.TargetAngle == 50 then
		hinge.TargetAngle =- 50
	end

end)


clickdetector.MouseClick:Connect(function()

	if hinge.TargetAngle == -50 then
		hinge.TargetAngle =- 0
	end

end)
local hinge = script.Parent.Hinge.Attachment.HingeConstraint
local clickdetector = script.Parent.Model.Main.ClickDetector
local Angle = hinge.TargetAngle

clickdetector.MouseClick:Connect(function()
	if Angle == 0 then
		hinge.TargetAngle = 50
	elseif Angle == 50 then
		hinge.TargetAngle = -50
	elseif Angle == -50 then
		hinge.TargetAngle = 0
	end
end)
local hinge = script.Parent.Hinge.Attachment.HingeConstraint
local clickdetector = script.Parent.Model.Main.ClickDetector

clickdetector.MouseClick:Connect(function()
	if hinge.TargetAngle == 0 then
		hinge.TargetAngle = 50
	elseif hinge.TargetAngle == 50 then
			hinge.TargetAngle =- 50
	elseif hinge.TargetAngle == -50 then
		hinge.TargetAngle =- 0
	end
end)

When you connect multiple callback functions to the same event object of an instance the most recent (last) callback connected overrides any others, instead you need to merge the three callback functions into a single function and connect that to the event instead.