0 votes

I'm making a script where it checks if my player is below a certain y value. Whenever I try to run it, it says Invalid operands 'Vector2' and 'int' in operator '+'.This is my code
func _physics_process(delta): if global_position.y >= 270: get_tree().reload_current_scene()
It might be because I use a physics process but I open a new function and made it a normal process but it still doesn't work. I've read other people's questions related to this but I tried them and it didn't work. Any help?

in Engine by (15 points)

1 Answer

0 votes
Best answer

That is not the code with the error. Somewhere you have a + operator with a vector on one side and an int on the other. Look at the line number in the error message and that will tell you where the problem is.

by (20,891 points)
selected by

I doesn't have a line number. It literally just says Invalid operands 'Vector2' and 'int' in operator '+'. If it helps it's in the debugger. I'm still new to godot and coding, so that might be why I can't find the line number.
Edit: found it I'm dumb.

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 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 webmaster@godotengine.org with your username.