This is my first post so i dont know everthying!
So i made a score for my clicker game and i made a shop too and i want the shop to check if your score is the same as the price or higher so you could buy it, if its lower than the price then you cant buy it, i made my score script global so that i could access the score in the shop script
But i’m making a score and i dont want it to say something specific, i want the numbers to increase, i have already made the code for the score to increase, and i have already made an @onready variable, and when i made my script global it started saying my label is null and my game doesnt work anymore, when i remove it from autoloads it becomes normal and works
Wow thanks! It works, i removed my score from globals and made a different script global and make it have the same variables, and switched “score” to “Global.score”
Hi!
Yep : maybe you can show us the top of your script. The reference might be missing.
And even if it worked, for now, your score would print 0.
You need to access the global variable directly as Ryn showed you.
In your _ready() you can write this (replace with your own names) :
score = GlobalScript.score
And in your on_touch_screen_button_pressed(), you must do the same.
The variable “score” here seems to not be useful as you pointed out that your score is computed in a Global script.
Dont worry! Its already fixed! I appreciate you for trying to help Marraw! Thanks. i already fixed everyrhing already, and im experienced with godot so yeah um Cheers!