|
| 16 Jul 2017 08:50 AM |
Why isn't the sound playing when the keyframe reaches footstep1 or 2?
local player = game.Players.LocalPlayer local character = game.Workspace:WaitForChild(player.Name) local humanoid = character:WaitForChild("Humanoid") local sound = script:WaitForChild("FootstepSound") local AnimationTrack = humanoid:LoadAnimation(script.Parent) AnimationTrack.KeyframeReached:Connect(function(name)
if name == "FootStep1" then sound:Play() end end)
AnimationTrack.KeyframeReached:Connect(function(name) if name == "FootStep2" then sound:Play() end end)
|
|
|
| Report Abuse |
|
|
|
| 16 Jul 2017 08:55 AM |
| The parent of this LocalScript is an animation. Let me correct myself, FootStep1 and FootStep # ################ ######### in an animation. so the question is................ why isn't the sound playing each time the animation reaches those keyframes? |
|
|
| Report Abuse |
|
|
Borsy
|
  |
| Joined: 31 Jul 2014 |
| Total Posts: 15111 |
|
|
| 16 Jul 2017 08:56 AM |
are you sure you named your keyframes correctly? try adding in print(name) to see if it even triggers or the keyframes are named differently
|
|
|
| Report Abuse |
|
|
|
| 16 Jul 2017 08:59 AM |
| You have a small redundancy in your script. You connect ################ ######### ## ############### when you only need one. Remove the second KeyframeReached event and add an elseif to the first one |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2017 10:24 AM |
The names are correct for sure and turn the code into an elseif statement didn't solve anything.
I'm not sure on how to do this, I looked at the example on the wiki, but I do not know where the keyframes for the animation are so I can direct the script to them. |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2017 10:34 AM |
| This outta be as accurate as footsteps get, common guys, help me out here! This can;t get done without the help of you guys!!! Now is the time!! Sisters, brothers, RISE! |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 16 Jul 2017 10:59 AM |
| Nobody wants accurate footsteps?! |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2017 11:16 AM |
| bump. cmon yall i need help. |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2017 11:19 AM |
| bump 1, The parent of the local script is the animation. |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Jul 2017 11:37 AM |
| omg cmon, ive been waiting 3 and 1/2 hrs for an answer. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Vultorz
|
  |
| Joined: 02 Mar 2015 |
| Total Posts: 2985 |
|
|
| 16 Jul 2017 12:01 PM |
I feel so bad... I want to help but I'm not sure how to do this.
i like coconuts |
|
|
| Report Abuse |
|
|
Borsy
|
  |
| Joined: 31 Jul 2014 |
| Total Posts: 15111 |
|
|
| 16 Jul 2017 12:20 PM |
put a print(name) to see if the names are correct and to see if it's even triggering if it prints the names correctly, then the sound is either not loaded, not entered or very quiet
|
|
|
| Report Abuse |
|
|
maxsmurf
|
  |
| Joined: 07 Mar 2011 |
| Total Posts: 718 |
|
|
| 16 Jul 2017 12:22 PM |
Q: Where are your (LocalScript) and your (Animations) into? ex: Workspace, ServerScriptStorage...
I think by inserting a loop it will work.
local Player = game.Players.LocalPlayer local Character = workspace:WaitForChild(Player.Name) local Humanoid = Character:WaitForChild("Humanoid") local Sound = script:WaitForChild("FootstepSound") local AnimationTrack = Humanoid:LoadAnimation(script.Parent)
while true do wait() AnimationTrack.KeyframeReached:connect(function(name) if name == "FootStep1" then Sound:Play() elseif name == "FootStep2" then Sound:Play() end end) end
Tell me how it goes! I apologize if it isn't working, I'm not really an advanced scripter!:D ( ͡° ͜ʖ ͡°) maxsmurf ( ͡° ͜ʖ ͡°) |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2017 11:51 PM |
I need more help guys, these solutions aren't working.
This has been going on for 9 hrs now... |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2017 11:57 PM |
are you even listening to borsy
tell us if it's printing out |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2017 12:07 AM |
| The print() functions under the if then statements don't print at all. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2017 12:48 AM |
| This is crazy, i've been waiting 11 hrs to find out what exactly my mistake is. Can someone help me please?! |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2017 12:55 AM |
AnimationTrack.KeyframeReached:Connect(function(name) print(name)
put a print like that right there and tell me what it says |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2017 01:01 AM |
I already said the event is not triggering, I have made prints, multiple times already on this script, as I said before the prints to not print at all. The events do not trigger and I don't know why.
Everyone out there, please help! |
|
|
| Report Abuse |
|
|
| |
|