Help with Simple Footsteps?

Hello,

Can anybody help me create a Simple Footstep script? I have tried writing my own and they work, but they are glitchy. I don’t need/want multiple footstep sounds, so really I just a need an audio source to play and stop when I use the “WASD” keys. If anybody could help me out with this, I would really appreciate it! I’ve been stuck on this for a while, and I would LOVE some help! Thank you for your time!

Make Javascript called FootStepsOn:

var AudioFile : AudioClip;
function Update() {

if (Input.GetKeyDown (KeyCode.W))
{
    audio.clip = AudioFile;
    audio.Play();
 
}
}

Then make Javascript called FootStepsMute:

var AudioFile : AudioClip;
function Update() {

if (Input.GetKeyUp (KeyCode.W))
{
    audio.clip = AudioFile;
    audio.Stop();
 
}
}

Haven’t tried it myself but here’s my two cent:

If it is for a FPS or similar, where you can’t see the feet it should just be something like:
if(isWalking) {
Footsteps.Play();
}

This however, will not work if it needs to be synchronized with the graphics.
Gl :slight_smile: