Im having troubles coding points multiplier system,Im new to coding
I want to make a system where upon collecting a carrot a value is added to the "bucket",and when the bucket gets to a certain value the Multiplier changes
Im mainly having problems with scopes of values of variables
Here's the code I have right now

 var Carrots : int = 0
@onready var label = $Control/Label
var CarrotMultiplier : int = 1  
var CarrotMultiplyerBucket : int = 0 


func _ready():
	SignalManager.Collected_Small.connect(smallcollected)


func _process(_delta):
	pass

func smallcollected():
	Carrots += 1 * CarrotMultiplier
	CarrotMultiplyerBucket += 1
	label.text = str(Carrots)

There must be a part of GDscript Im missing

I think you're doing fine so far. You just need to check your bucket each time after you add 1 to it. What "certain value" did you have in mind for the bucket? Is it the same every time? If so, that is straightforward.

func smallcollected():
	Carrots += 1 * CarrotMultiplier
	CarrotMultiplyerBucket += 1

        if CarrotMultiplyerBucket >= CertainValue: #is the bucket full?
                CarrotMultiplier += 1 #add 1 to the multiplier
                CarrotMultiplyerBucket -= CertainValue #empty the bucket

	label.text = str(Carrots)

    award
    I apologize,I forgot to mention A LOT of stuff
    There will be multiple signals that add different amount of carrots
    And the bucket depletes overtime if no carrots are being collected

    It all would be relatively easy to code if I knew how to share value of the bucket between functions
    If that's even possible

    • Toxe replied to this.

      I changed to a more suitable tag for this discussion. 👍

      Dzhaba_Rottn if I knew how to share value of the bucket between functions

      Which value do you want to share between which functions?

        Toxe
        Value of the bucket,shared between 3 signal functions and the function that depletes the bucket overtime if carrots arent being collected

        I think I can do it using set and get,and I could also cut the number of signals to just 1 if sharing values through signals works like I think it does.