Setting the alpha value of a gui element (SOLVED)

How do you set the alpha value of a gui node. I have tried using"nodeName", "color.w", "0") But to no avail. Any idea why?

I believe you have to interact with gui nodes via the gui api (from a .gui_script file):

local node = gui.get_node( "nodeName" )
gui.set_color( node, vmath.vector4(0, 0, 0, 0) )

Works for me.


Thanks, I never realised you had to store the node into a variable.

1 Like

You don’t have to:

gui.set_color(gui.get_node("nodeName"), vmath.vector4(0, 0, 0, 0))

But if you use the node in several places it’s better.


thanks, I am only starting to mess around with GUIs now

1 Like

Hey @Justin_H,

I am trying the same but it doesnt work for me.
I use a gui script to change the colours of some squares if you click on them but it only turns the squares white.

gui.set_color(current_node, vmath.vector4(204, 128, 51, 1))

Do you know what is wrong?

The color values should be in the range of 0.0 to 1.0. What you need to do is to divide your RGB values with 255.


Hey @britzl ,

Thanks a lot!

1 Like