I made a simple clicker, but there was a problem with displaying the variable

Hey @iLshat423,
:tada: welcome to the Wick forums!! :tada:

Looks like there’s an object inside of the setText function you’re using.
Can you share a copy of your code for setting the text so we can see what it is?

button code:
mouseclick
project.score += 1
score.setText(project.score)
frame code:
project.score = 0

I see the error— the text is called “score” and your score variable is called “project.score.”
Since the text object is inside of the main project, you can also call the text “project.score” if you wanted to. In other words, both the variable and the text object have the same name, which is what’s causing this issue.

To solve this issue, you can change the text object’s name from “score” to something else, like “scoreText,” and adjust the code.

Let me know if that works

It worked. Thanks

1 Like