Simple function script doesn't seem to be working

I’m trying to make a windmill with a button to control It’s direction and state but it isn’t working.

function OnClick ()
	
	if game.Workspace.Windmill_Kinda.Foundation.HingeConstraint.AngularVelocity == 2 then
		game.Workspace.Windmill_Kinda.Foundation.HingeConstraint.AngularVelocity = 0
		
	elseif game.Workspace.Windmill_Kinda.Foundation.HingeConstraint.AngularVelocity == 0 then
		game.Workspace.Windmill_Kinda.Foundation.HingeConstraint.AngularVelocity = 2
	end
end

function OnAlternateClick ()
	
	if game.Workspace.Windmill_Kinda.Foundation.HingeConstraint.AngularVelocity == 2 then
		game.Workspace.Windmill_Kinda.Foundation.HingeConstraint.AngularVelocity = -2
		
	elseif game.Workspace.Windmill_Kinda.Foundation.HingeConstraint.AngularVelocity == 0 then
		game.Workspace.Windmill_Kinda.Foundation.HingeConstraint.AngularVelocity = -2
		
	elseif game.Workspace.Windmill_Kinda.Foundation.HingeConstraint.AngularVelocity == -2 then
		game.Workspace.Windmill_Kinda.Foundation.HingeConstraint.AngularVelocity = 0
		end
end

game.Workspace.Windmill_Kinda.Button.Button.ClickDetector.MouseClick:Connect(OnClick)
game.Workspace.Windmill_Kinda.Button.Button.ClickDetector.RightMouseClick:Connect(OnAlternateClick)

image

Anyone know why?
There aren’t any errors.