I have a Gui script that just makes a box a says “0 coin(s)” I want it so if you collect 1 of the coins it adds 1. I made it so that if you collect the first coin it will say
“1 coin(s)” and I did it with the other coin so it says 2 coins. But if the player collects them in a different order, he/she will end up with 2 coins at first then 1 coin.
1 Answer
1You need to look at how variables work.
First, give your player an integer variable called CountCoins. Set it to 0.
Then, set your GUI Script to use the text
"Coins :"+player.CountCoins
instead of just text.
Now, instead of changing the gui text when you hit a coin, change the value of Player.CountCoins to increase it by 1.
player.CountCoins=player.CountCoins+1;
You will need to change this a little bit to make it work, depending on how your other scripts are set up, but learning to use variables like this is the most important first step in coding.
Yes I was going to use a variable but it didn't end up working. I know the reason now and I'm adding some of your script in. Thank you very much for the scripts :)
– pastrana200