How do I make my total add up each time I roll a dice's side?

Hello,

I am trying to get my assignment done for my class. While my teacher has been encouraging me, he has been mostly unhelpful since this assignment is “figure it out yourself” type…

I have seriously no experience in programming; however I managed to get like 80% done.

I am trying to get the total added up every time you roll a dice and whatever side you get, gets added to the total. Like side 11 was your total; roll the dice again and your side will be 12 which adds up the total to 23.

Here’s the Dice roll UI along with part of the script.


123895-diceroll-uiscripts.png

Good day.

I recommend you to have a int variable to store the acumulated value, where you will add all results.

int totalNumber;

Once you have one dice result, you add it to the total with this:

totalNumber = totalNumber + newNumber;

or this, that is Exactly the same:

totalNumber+=newNumber;

So every time you have a dice result, it will be added to the total. Then only need to show in the text the total.

Bye!!