Accessing variables from a class

This is going to sound really dumb, but I am going from JS to c# now, and I cant figure out something really simple:

In the following code, how can I pull in the variable speed into the update function? I cant seem to understand the syntax I need here.

[System.Serializable]
public class playerOneAttributes
{
    public string playerOneName = "Player 1";	            //Players name in game, can be changed
    public int playerOneHealth = 100;			            //Players Total Current Health
    public int playerOneRangePower = 100;		            //Players range damage (ie. fireballs, arrows)
    public int playerOneMagicDamage = 100;		            //Players spell damage from potions
    public int playerOneMeleeDamage = 100;		            //Players melee damage
    public int playerOneDefense = 10;			            //Players Defense
    public int playerOneMoveSpeed = 100;		            //Players movement speed
    public int playerOneXP = 0;				                //Players XP
}

void Update () 
    {

        int speed = 
        
}

I have tried using Getcompnent<> but no matter how I type it, it errors.

Sorry for the really dumb question!

Thats because it doesn’t, in your code above you closed your class before the method Update.

Use this:

    [System.Serializable]
    public class playerOneAttributes : MonoBehavior
    {
        public string playerOneName = "Player 1";               //Players name in game, can be changed
        public int playerOneHealth = 100;                       //Players Total Current Health
        public int playerOneRangePower = 100;                   //Players range damage (ie. fireballs, arrows)
        public int playerOneMagicDamage = 100;                  //Players spell damage from potions
        public int playerOneMeleeDamage = 100;                  //Players melee damage
        public int playerOneDefense = 10;                       //Players Defense
        public int playerOneMoveSpeed = 100;                    //Players movement speed
        public int playerOneXP = 0;                                //Players XP
    
     
    void Update () 
    {
        int speed = playerOneMoveSpeed;
    }
}

If you intended on playerOneAttributes to be just a class and not inherit from monobehavior, you will need to instantiate the object form the class to access your properties.