Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make custom footstep sounds?

Asked by 4 years ago

Now i dont know what happen but my footstep script got broken,this wasn't the case a few days ago, It may be a roblox update, Now i dont know where to start can anyone help me?

2 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

We need a few things to make this script: a script obviously, detect what material the player is standing on, detect if the player is moving, and the sounds.

Conveniently, Roblox actually has a FloorMaterial in the Humanoid of each player which outputs a Material Enum of the surface the player is standing on. To detect if the player is walking we can use either the Running event from the Humanoid or just check the HumanoidStateType to see if the player is running. Then just get some sounds for the footsteps and connect it all together to make your script

Ad
Log in to vote
0
Answered by
ArtBlart 533 Moderation Voter
4 years ago

I think a good place to start is with Raycasting. You can use a ray for a multitude of things, including sending a ray below your player and checking what type of part they're standing on. This in turn, can be used to change the walking sound of the player based on the part's material that they're standing on.

I wont include any code for this, as raycasting has been covered by many tutorial videos and there are a lot of good resources online to figure out how raycasting works and what each of the ray functions do.

I can point you in the right direction, however. A good place to start is with workspace:FindPartOnRay(), which if it hits a part that is not on the ignore list, will return said part. This may turn out to be very useful for your applications. Best of luck to you and happy coding!

Hope this helps! If you have any further questions feel free to comment or look things up on the devforum.

0
Raycasting is a waste of performance for this application Warfaresh0t 414 — 4y

Answer this question