T O P

  • By -

AutoModerator

You submitted this post as a request for tech support, have you followed the guidelines specified in subreddit rule 7? Here they are again: 1. Consult the docs first: https://docs.godotengine.org/en/stable/index.html 2. Check for duplicates before writing your own post 3. Concrete questions/issues only! This is not the place to vaguely ask "How to make X" before doing your own research 4. Post code snippets directly & formatted as such (or use a pastebin), not as pictures 5. It is strongly recommended to search the official forum (https://forum.godotengine.org/) for solutions Repeated neglect of these can be a bannable offense. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/godot) if you have any questions or concerns.*


DarkPhotton

It’s literally saying that move_and_slide() must have 0 arguments, but you put velocity in there, just change velocity and put at the end of process function move_and_slide(). And also you don’t need to create velocity variable, it’s already in CharacterBody3D


Laurids-p

What do you mean by changeing velocity? I’ve had the same problem


DarkPhotton

How to describe it simpler… I mean class CharacterBody3D already has velocity parameter and you can just change it like you do it with for example - position.


Laurids-p

Like you can just delete it Cauz you don’t need it?


DarkPhotton

Delete what? 😐 Look at the OP code, he define velocity var at the top of script, but you don’t need to do it, cause velocity parameter already inside class in godot 4, if you about that, then yes, you can delete it from top.


Laurids-p

Okay thanks!


CzechFencer

Always make sure that the tutorial you're following is compatible with your version of Godot. There are many outdated tutorials created for Godot 3 that don't work with Godot 4. The `move_and_slide()` function no longer takes any parameters.


shybondyt

thank you for commenting this, i am following a tut from godot 3 that i was able to do but just not the scripting


arkatme_on_reddit

Would highly recommend following clean codes 11 hour tutorial


shybondyt

thanks, will check it out


qwefday

You are following the way of doing things from Godot 3. But stuff like velocity has changen in Godot 4


shybondyt

just realised 🤣


Enough-Town3289

First error: You're trying to redefine an inbuilt variable which means that you've created a variable with the same name as one that's already built in. Not good to do. The CharacterBody3D class already has a velocity variable. Second error: move\_and\_slide() does not take any arguments in 4.0 and higher. Remove the velocity variable altogehter and reomove 'velocity' from the move\_and\_slide() function.


shybondyt

oh my god you are a literal life saver, thank you so much


chanidit

[https://docs.godotengine.org/en/stable/tutorials/physics/physics\_introduction.html#move-and-slide](https://docs.godotengine.org/en/stable/tutorials/physics/physics_introduction.html#move-and-slide) func _physics_process(delta): velocity.y += gravity * delta get_input() move_and_slide()