Interact with object then disappears and one that teleports player

Hi i want to be able to press e on a object and make it disappear then play a sound effect and a object that you press that plays a sound effect then teleports the player.
please note that i am really new to godot and coding please explain like im 5 lol not kidding
also this is in 3d.
anything helps thanks

First resources : Godot Docs – 4.2 branch — Godot Engine (stable) documentation in English

Has all the good info and tutorials, but a little tricky to search you can get the same stuff in the editor and its searchable.

Now you want to click an object on the screen and make it disappear and play sound…

I will assume this will be 2D (3D should be similar but examples I post will all focus on 2d)

  • We need to choose a CollisionObect2D class
    • Area2D: creates an area on the screen that can detect objects entering
    • RigidBody2D: a physics based object that can move and collide and is effected by gravity
    • StaticBody: a physics object that can collide but is not effected by gravity and is fixed in place

Once we choose we can configure the body to be mouse clickable.
here is a good doc on input events in godot.

pay close attention to this bullet point

So we need to create a scene and it should look something like this

make sure we set the staticbody to pickable

Notice we have a script attached to the static body, this script will recieve the click event on the static body and play the animation. The animation player will trigger the audio player to play a sound, and will also make the sprite invisible, and after the sound is played delete the node.

Here is the animation panel with all tracks setup

This is the script on the static body:

extends StaticBody2D

# if mouse is over object when clicked this function will get called
# if the left mouse button is clicked play animation "Disapeared"
func _input_event(viewport, event, shape_idx):
	if event is InputEventMouseButton:
		if event.button_index == MOUSE_BUTTON_LEFT:

I had trouble making a video, and there is just to many small details to explain everything. but I hope this isn’t too complex, and I think the basic things like “how do I make a scene”, “how do i add animation tracks and key frames” or “how attach a script” can easily be googled or found in the documentation.

One tip ill give you is that if you have some script code and you need to look at the documentation you can CTRL+Left-Click on the class name, or function, and it should take you straight to the doc in the editor. or to the custom class script the code is referencing.

Thank you i shall try this when i can