6. Change a bar with an action
For an unbound meter, use Change GUI Element Property. This is the simplest first test: a Button changes one element’s current value.
1. Add a Button beside the Progress Bar.
2. Open its Events tab. Choose Change GUI Element Property for Click.
3. Set GUI to progress_lab, Element to power_bar, Property to value and To to 50.
4. Run the game and press the Button. The meter should become half full when Maximum is 100.
extends "res://scripts/runtime/script_base.gd"func run(_context: Dictionary = {}) -> Variant:
await ChangeGUIElementProperty({
"guiId": "progress_lab",
"elementId": "power_bar",
"property": "value",
"value": 50
})
return trueThis is a complete GDScript record for the same operation. Apply it, then assign the record to the intended event or script-running action. The shared action also exists in action lists and visual scripting.
Use this value-based method for an unbound meter. If variable is set on the element, update that variable instead; the next dynamic refresh reads it and can replace a direct value change.
