Hello, I’m having trouble achieving accurate footstep sounds in my game (Similar to “3008” and “Pressure”).
I’ve tried multiple solutions, but most either lag, delay or repeat more than necessary.
I have a module for all the different sounds (made by a different dev), but how would I implement them playing at the right time?
Help/resources are much appreciated.
go to the documentation, the normal footsteps is in a folder somewhere (i think) and you can change them there
the names are the material it will be played on, i reccomend setting air to volume 0
edit: no link since documentation doesnt have naything about footsteps?? idk why
Yes I’m aware of where it is, but my problem is accurately checking whenever a player’s foot touches the ground when walking and checking what material it is, to give it a correct sound chosen from the table of sounds I have
thats because its an animation. You could maybe get the time from the animation and if its near the position where the foot is on the ground in the animation you can play the sound
Edit: However making this custom is VERY HARD TO DO Ive tried making custom animations script and it failed horribly. There is a reason the core animate script is so long… A reason.
Tried this, added an event to the animation whenever the foot touches the ground and it wasn’t very accurate/lagged (I reuploaded the running animation with the event)
You sure?
- get the animation time (progress of animation)
- mark the spots where the foot touches the ground
- build a debounce so it cant spam it and only if it reaches the other stamp it will play the sound again
- play the sound when the stamp is hit.
I used :GetMarkerReachedSignal() for it, I’m not sure if it’s not accurate OR the problem might be on my end cause it might lag. But whatever I tried didn’t reach the level of accuracy that they have in “3008”
ugh let me just cook up some code
this is going to take some time, this is the last thing im going to do to try and help you.
Ill edit this post once done.
edit1:
local player = players.LocalPlayer
local Humanoid = Character:WaitForChild("Humanoid")
local animate = player.Character:FindFirstChildOfClass("LocalScript")
if animate then
local runanim = animate:FindFirstChild("run"):FindFirstChildOfClass("Animation")
if runanim then
if Humanoid:FindFirstChildOfClass("Animator") == nil then
local inst = Instance.new("Animator")
inst.Parent = Humanoid
end
local loaded = Humanoid:FindFirstChildOfClass("Animator")
if loaded then
local run = loaded:LoadAnimation(runanim)
run:GetTimeOfKeyframe()
end
end
end
--localscript
Turns out you are using wrong function
Alright, take your time and thanks for helping me lol
It depends on what you want, but if you need something very accurate then just raycast downwards from players feet towards the ground and whenever the ray hits something check its material and then play the appropriate sounds.
If you need something simpler then you can make markers in your walking animation for when character places feet on the ground, connect the marker with code so it plays sounds then raycast downwards from players HumanoidRootPart towards ground and check material.
You can make Animation Events in the walking animation, then play the footsteps when the event happens. Also im guessing you’re using uglyburger0’s footstep module?
can you fricking read? he tried that.
Have tried that, and yes I’m using the 3008’s devs module
Bla Bla BLA, He tried that, he wants accuracy, Raycasting for footsteps? unoptimized and very laggy.
“Markers in the walking animation” idk anything about marking animation frames. Your onto: nothing?
Next time think a bit more before repeating something
I tried that myself and it worked fine for me. Maybe he is doing it wrong?
Could you show me the bare-bones of how I would go about doing that? (raycasting from players feet)
PLease be respectful, he’s just trying to help
I personally wouldn’t recommend that, as animations are a simpler and more optimal approach, and physically detecting if the player’s feet are on the ground can cause some issues.
It does work, but every now and then just messes up in some way or another like delaying the sound or not playing it at all.
im going to give you some code in a minute, it will work and be 1000 times more optimized then the raycast BS. (btw raycasting has several delays and is to precies and accurate to be used for footsteps, and you even need to repeat it so yea no thats not going to work)
Edit: THink about the lag if 20 players have 40 rays shooting out of thier feet each frame…