Trying to make the Cursor Invisible when a UI button is pressed

Hello, so I am trying to make a Horror game and when the main menu button is pressed to make the cursor invisible. Except I have looked everywhere and I can’t get it to work. Here is the code I am using`using UnityEngine;
using System.Collections;

public class Cursor : MonoBehaviour
{

%|-496017692_2|%
%|-353848803_3|%
UnityEngine.Cursor.visible = true;
%|135087020_5|%
void onClick()
{
%|1332819508_8|%
%|-1904072890_9|%

}

And the OnClick is connected to a button like in this picture
90540-problem.jpg
I am using C# for this and I would appreciate it if whoever helps me can use C# too. Thanks!`

The OnClick event on your button isn’t setup correctly. What you’re doing is setting Cursor.name to a string "onClick()". You should make your Cursor class’s onClick method public, and then choose Cursor>onClick in your button’s inspector.

@Ran-Quan I’m kind of a noob but I can’t get it to change to a public method