# Error when trying to disable a button

**URL:** <https://forum.godotengine.org/t/error-when-trying-to-disable-a-button/3093>\
**Category:** Archive\
**Created:** [November 8, 2022, 12:06pm UTC](https://forum.godotengine.org/t/error-when-trying-to-disable-a-button/3093 "2022-11-08T12:06:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://forum.godotengine.org/uploads/default/original/2X/4/4b0a7fa8a6334634b94a13d421f0d99e6f04e21f.svg) [@system](https://forum.godotengine.org/u/system)\
**Post date:** [November 8, 2022, 12:06pm UTC](https://forum.godotengine.org/t/error-when-trying-to-disable-a-button/3093/1 "2022-11-08T12:06:44Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **Attention** | Topic was automatically imported from the old Question2Answer platform. |
| 👤 | **Asked&nbsp;By** | Tim Log |

Hi, i’m new to Godot  
This is my first Godot project. Its for my school project  
I working on a farming game  
What i want to do here is disabling a button if the coin variable is less than 25. The concept of that looks like this: You don’t have enough money = you can’t buy the item  
Here is the code:

```
extends Node

func _process(delta):
  If Global.coin < 25:
    $parent/BuyButton.disabled = true

```

But, when i run the game, and click a button that decrease coin variable until the coin value is below 25, its shows an error message: Invalid set index ‘disabled’ (on base: ‘null instance’) with value of type ‘bool’.  
How do i fix that?

P.S: Sorry if my question looks un-specific(or have bad grammar)

---

<div class="post-metadata">

**Author:** ![system](https://forum.godotengine.org/uploads/default/original/2X/4/4b0a7fa8a6334634b94a13d421f0d99e6f04e21f.svg) [@system](https://forum.godotengine.org/u/system)\
**Post date:** [November 8, 2022, 12:37pm UTC](https://forum.godotengine.org/t/error-when-trying-to-disable-a-button/3093/2 "2022-11-08T12:37:50Z")

</div>

| | | |
| --- | --- | --- |
| 👤 | **Reply From:** | Picster |

The message says that the node you are trying to get via `$parent/BuyButton` was not “found”.

if you try to get the parent node, it would be `get_parent().get_node("BuyButton").disabled = true`

Im just going to try it without the getting the parent:

```auto
extends Node

func _process(delta):
  if Global.coin < 25:
    get_node("BuyButton").disabled = true

```

and still the same error

Tim Log | 2022-11-10 13:15
