1 | Score = 0 |
2 |
3 | if workspace.PartScoreBoard.SurfaceGui.Frame.Pin 1. BackgroundColor 3 = = Color 3 ( 1 , 0 , 1 ) then |
4 | Score = + 1 |
5 | end |
I'm trying to add to the value when when the color of a certain background turns pink.
But so far I'm not getting anywhere, how Do I add to score when something happens?
What you did wrong was say Score = +1 which basically means it equals positive 1. When adding to a value you must index it again after the = sign.
1 | Score = 0 |
2 | if workspace.PartScoreBoard.SurfaceGui.Frame.Pin 1. BackgroundColor 3 = = Color 3 ( 1 , 0 , 1 ) then |
3 | Score = Score + 1 |
4 | print (Score) |
5 | end |
Some extra examples of adding to values IntValues:
1 | local IntVal = script.IntValue --setting a variable for an IntValue located under the script |
2 |
3 | IntVal.Value = IntVal.Value + 10 --Adding 10 to the value |