Getobject and set text help?


what does getobject and settext do and how could they be used??


getObject can be used to get any object with a name inside of your project.
So let’s say I have a global score variable.

project.Score = 0;

Now I can create a text object and name it ‘scoreLabel’ (or whatever you want to call it) and use getObject to store it into a variable.

project.Score = 0;
var text = project.getObject('scoreLabel);

Now you can use ‘text’ when you are referencing to ‘scoreLabel’ inside of your project.

Finally, because text (‘scoreLabel’) is a text object, you can use setText() to set the text to the specified input.

So the final code would be this:

project.Score = 0;
var text = project.getObject(‘scoreLabel’);
function load() {
text.setText('Score: ’ + project.Score);


thanks, but how do i script so that when i press a button for example it adds to the score?
moneyclicker.wick (8.9 KB)


Mister Mender, I tried your suggestion and it didnt work. I have an object that I have to click. Every time I click it I want the score to go up by one. HELP


@Tsake Nice project!
So remember the

function update(){}

Will update very fast, so we can set the text ‘scoreLabel’ to the project.Score value with that!
(Inside of the button)

function update() {
text.setText('Wulfbux: ’ + project.Score);

Next we need to make sure the score gets added onto with every click!

function mousePressed(){
project.Score += 1;

Here is your project now! moneyclicker-Jan4-2019-9.54AM.wick (9.0 KB)
@Animator786 Maybe this will also help you?


I made a basic game based off of cookie clicker. It incorporates Mister Menders code. Please DO NOT steal my game. i plan on posting it on Newgrounds.
New Project-Jan4-2019-12.41PM.wick (1.5 MB)