Gui counting table (SOLVED)

I try to make gui counting table but when i use gui.set_text console give me EROR: bad argument #1 to ‘set_text’ (userdata expected, got string)

Could you post the code example you are testing with?

The first argument to gui.set_text() should be a node instance and it seems as though you are passing it a string, perhaps the node name?

You have to use gui.get_node. “score_t” is just a string and not actually a node, which is what gui.set_text is expecting as its first argument.

Try this

gui.set_text(gui.get_node("score_t"), tostring(score))

Or if you are going to be using the node in many places you can use it like this

mynode = gui.get_node("score_t")
gui.set_text(mynode, tostring(score))
2 Likes

Thank you. Now all going well.

1 Like