Hello,

I am trying to change scene, but I keep getting an error and I can't figure out why.

As you can see I have some remnants of other ways I tried but none seemed to work and I kept getting the same error:

It is not an error. It's just a warning. You can disable various types of warnings via project settings, under Debug/Gdscript, but I wouldn't recommend doing so.

Note that errors are in red text and warnings in yellow. There is no issue with ignoring warnings, the game will still run, but it may be a good idea to fix them out of habit, that way you are more likely to see important warnings and just as a good practice anyhow since some warning may be helpful. In this case it is telling you that the function returns a value that you are not using, so just make a new value like this:

var scene_val = get_tree().change_scene(mapScene)

oh, it's not changing the scene which is why I thought it was an error. I click the button but everything stays the same nothing changes

Try to put a print statement in _button_pressed() to check if it even gets called.
If it's called normally, then try to utilize the runtime error mechanism the warning was complaining about in the first place - check the return value of change_scene() and see if returns an error code. Various error codes are described here.

You were right the function wasn't getting called so I had to use _pressed() instead. Thanks!

a year later