C# how can I set the value of a variable in one script component to another?

Hello, in my game I have multiple characters that each have their own specific script to control them, but they also each have a script of variables that govern the rules of the game and how the characters interact with each other.

for example: in the script “VarsForAllChars” HP is set to 5 at the start. So how do I make it so that in another script that is attached to the character as a component, lets say “ControlJames” that james is allowed to set the HP value in his VarsForAllChars script at anytime?

Use GetComponent from the “ControlJames” script to get the “VarsForAllChars” component.