Please Help, Problems with change scene script

_close_menu() function just a method to open and close ingame menu,
in ui.gd :

func _on_menu_button_pressed():
get_tree().paused = true
_open_menu()

func _open_menu():
$ingame_menu.visible = true

func _close_menu():
$ingame_menu.visible = false

func _on_resume_pressed():
get_tree().paused = false
_close_menu()

due to all respect, please forgive me,
im using my phone to login in,
so i it may be messy and many typos in my script…

Can you tell the steps you do to achieve this state?

No worries, we are here to help.
We just need you to produce the error again and then check the remote tab as I’ve described.

Right now I can only assume what the problem is and my solution would not necessarily solve the issue.

as our previous scene still there,
so its may look like in scene level 2 but, under the scene level 2,
we still have level 1 scene…
it makes player still can walk on level1 tilemap although we in level 2

Right now this is where we are at. The player is on level1 AND level2 tilemap, which means everything will be solved if we can safely remove level1.

Once you go into the Remote Tab, you should see Level1 and Level2. If that is the case, try hiding the Level1 Node by clicking on the Eye-icon. This will temporarily hide Level1.

2 Likes

Instead of this:

elif error == ERR_FILE_EOF:
	var scene = loader.get_resource().instance()
	get_tree().get_root().call_deferred("add_child", scene)
	loading_scene_instance.queue_free()
	return

do this:

elif error == ERR_FILE_EOF:
	var scene: PackedScene = loader.get_resource()
	get_tree().change_scene_to(scene)
	return
1 Like

Hello guys,
finally its solved…
thank you for helping me solving this problems…
all credits for herrspaten who solve this…
and not to forget thank you so much for locher who also help me with it :smiling_face_with_three_hearts: :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:
by the way for everyone who counter this same problems,
this how to solved it:
change this line of code

elif error == ERR_FILE_EOF:
		var scene = loader.get_resource().instance()
		get_tree().get_root().call_deferred("add_child", scene)
		loading_scene_instance.queue_free()
		return

with this one :

elif error == ERR_FILE_EOF:
			var scene: PackedScene = loader.get_resource()
			get_tree().change_scene_to(scene)
			loading_scene_instance.queue_free()
			return

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.