0 votes

MenuButton function is working but RestartButton function is not working.Why is it not working.Also this is stop menu scene and I'm putting it in every level

func onRestartButton_pressed():

$RestButton.frame = 1

func onMenuButton_pressed():

$MenButton.frame = 1

Godot version 3.2
in Engine by (70 points)

1 Answer

–1 vote

What do You mean no error ? No error in console ?
reloadcurrentscene returns information on why the scene could not be reloaded. Just print(reloadcurrentscene())

by (7,753 points)

It's not allowing me to print a function

The method "reloadcurrentscene" isn't declared in the current class.

You weren't supposed to print it literally, You repeated my typo's :)

Look at the function You used in documentation. It says it returns ERROR when something goes wrong. It says, that there are 3 possible errors when scene does not reload - no current scene defined, impossible to instantiate scene, impossible to get packed scene. You need to use print to get and read this error. SOmething like this :

If get_tree().reload_current_scene() == 1:
      print("error nr 1")
elif get_tree().reload_current_scene() == 2:
     print("error nr 2")

and so You will know why it does not work

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.