Plz help print not working

this may be a stupid question but my print command isnt printing anything in the output panal if anyone can help plz respond

Always show the code you’re using to help determine if it’s an error with the code. Make sure you’ve used the print method correctly. Are you getting any errors?

1 Like

no im not getting any errors

We cant help you if you dont show the code

this is what i need help with
image

its where the kaboom print is

The code should be:

func _on_body_entered(body:Node) -> void:
    if body.is_in_group("Goal"):
        print("You Win!")
    elif body.is_in_group("Hazard"):
        crash_sequence()

func crash_sequence() -> void:
    print("KABOOM")

If that doesn’t work, replace the node contained in the _on_body_entered() function to be a Node2D or Node3D depending if you making a 2d or 3d game.

ohh ok thx

Tell me if it works!

it didnt work

Is your colliding body in group “Hazard”? Can you show how you set up that scene tree?

ok so this

1 Like

Ok, does your player have an Area3D? What is connected to the _on_body_entered function?

1 Like

its connected to the floor im pretty sure

Nothing in this scene screenshot has a signal connection.

The player is an instantiated scene, which could have a Area3D child with the signal connected; but I can’t tell from this screenshot.

If there is no present Area3D, with a connection, then there is nothing triggering this code to work.


If it was connected to the Floor then the other “body” would be the player/launch pad, which neither are grouped in Goal or Hazard; but I’m certain it is not connected to the Floor.

show us ur players scene
And its entire script.

Press the </> icon when making a reply and copy paste your script into it.

extends RigidBody3D 

## How much verticle force when going up 
@export_range(750.0, 3000.0) var thrust: float = 1000.0

@export var torque_thrust: float = 100.0

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	if Input.is_action_pressed("boost"):
		apply_central_force(basis.y * delta * thrust)
		
	if Input.is_action_pressed("left"):
		apply_torque(Vector3(0.0, 0.0, torque_thrust * delta))
		
	if Input.is_action_pressed("right"):
		apply_torque(Vector3(0.0, 0.0, -torque_thrust * delta))


func _on_body_entered(body: Node3D) -> void:
	if body.is_in_group("Goal"):
		print("You Win!")
	elif body.is_in_group("Hazard"):
		crash_sequence()
	
func crash_sequence() -> void:
	print("KABOOM!")

the groups are connected with floor

Assuming this is the Player’s script, it is missing the body_entered signal connection. Edit your player scene, select the RigidBody go to the “Node” tab and connect body_entered to your script.

Please read through the link @gertkeno provided or watch a video on: “Signals”

Due to the comment in your code, I assume you are following a tutorial or took some code, meaning functions meant to be connect to signals aren’t.
You can connect them through the “inspector”