# Help please (810594)

**URL:** https://discussions.unity.com/t/help-please-810594/810594
**Category:** Getting Started
**Created:** [September 29, 2020, 4:47am UTC](https://discussions.unity.com/t/help-please-810594/810594 "2020-09-29T04:47:45Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![SHAUZZ](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SHAUZZ](https://discussions.unity.com/u/SHAUZZ)
#### Post date: [September 29, 2020, 4:47am UTC](https://discussions.unity.com/t/help-please-810594/810594/1 "2020-09-29T04:47:45Z")

</div>

Help my character is jumping infinitly what to do I found the code on youtube brackeys channel im super new to programming.  
Here is the code

using System.Collections;  
using System.Collections.Generic;  
using UnityEngine;

public class PlayerMovement : MonoBehaviour  
{  
public CharacterController controller;

public float speed = 10f;  
public float gravity = -10f;  
public float jumpHeight = 5f;

public Transform groundCheck;  
public float groundDistance = 0.4f;  
public LayerMask groundMask;

Vector3 velocity;  
bool isGrounded;

void Update()  
{  
isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

if(isGrounded && velocity.y \< 0){  
velocity.y = -2f;  
}

float x = Input.GetAxis(“Horizontal”);  
float z = Input.GetAxis(“Vertical”);

Vector3 move = transform.right \* x + transform.forward \* z;

controller.Move(move \* speed \* Time.deltaTime);

if(Input.GetButton(“Jump”) && isGrounded){  
velocity.y = Mathf.Sqrt(jumpHeight \* -2f \* gravity);  
}

velocity.y += gravity \* Time.deltaTime;

controller.Move(velocity \* Time.deltaTime);

}  
}

---

<div class="post-metadata">

### Author: ![UnityMaru](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/unitymaru/32/44206_2.png) [@UnityMaru](https://discussions.unity.com/u/UnityMaru)
#### Post date: [September 29, 2020, 3:47pm UTC](https://discussions.unity.com/t/help-please-810594/810594/2 "2020-09-29T15:47:56Z")

</div>

Hey there,

Could you link the video/tutorial? Also, would be handy to understand what version of the Editor you are using 🙂

---

<div class="post-metadata">

### Author: ![Joe-Censored](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/joe-censored/32/419943_2.png) [@Joe-Censored](https://discussions.unity.com/u/Joe-Censored)
#### Post date: [September 29, 2020, 10:57pm UTC](https://discussions.unity.com/t/help-please-810594/810594/3 "2020-09-29T22:57:31Z")

</div>

Use Debug.Log. Check what the value of isGrounded is. Check if the “Jump” button is being pressed when you expect it not to be pressed. Output the value of velocity.y. “gravity” is a public field, so make sure it is set to a negative number, such as -10f, in the inspector. A positive gravity value would result in just flying away whenever not jumping. etc, etc, etc good luck

---

<div class="post-metadata">

### Author: ![SHAUZZ](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SHAUZZ](https://discussions.unity.com/u/SHAUZZ)
#### Post date: [September 30, 2020, 3:33am UTC](https://discussions.unity.com/t/help-please-810594/810594/4 "2020-09-30T03:33:53Z")

</div>

UnityMaru this

[![](https://europe1.discourse-cdn.com/unity/original/4X/c/9/0/c9038746cc55b54951c52db0470c50c20534fc51.jpeg "FIRST PERSON MOVEMENT in Unity - FPS Controller") ](https://www.youtube.com/watch?v=_QajrabyTJc)

---

<div class="post-metadata">

### Author: ![SHAUZZ](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SHAUZZ](https://discussions.unity.com/u/SHAUZZ)
#### Post date: [September 30, 2020, 4:05am UTC](https://discussions.unity.com/t/help-please-810594/810594/5 "2020-09-30T04:05:52Z")

</div>

Im using 2019.4.11

---

<div class="post-metadata">

### Author: ![SHAUZZ](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SHAUZZ](https://discussions.unity.com/u/SHAUZZ)
#### Post date: [September 30, 2020, 4:09am UTC](https://discussions.unity.com/t/help-please-810594/810594/6 "2020-09-30T04:09:14Z")

</div>

Joe Censored how do you check the value of IsGrounded im very new to unity

---

<div class="post-metadata">

### Author: ![SHAUZZ](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@SHAUZZ](https://discussions.unity.com/u/SHAUZZ)
#### Post date: [September 30, 2020, 6:38am UTC](https://discussions.unity.com/t/help-please-810594/810594/7 "2020-09-30T06:38:09Z")

</div>

I can jump while in the air what to do

---

<div class="post-metadata">

### Author: ![UnityMaru](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/unitymaru/32/44206_2.png) [@UnityMaru](https://discussions.unity.com/u/UnityMaru)
#### Post date: [September 30, 2020, 10:24am UTC](https://discussions.unity.com/t/help-please-810594/810594/8 "2020-09-30T10:24:41Z")

</div>

Judging by the YouTube comments, a lot of users are running into the same problem. You may want to look through those comments for a solution.
