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

¿Why my walk animation don't play?

Asked by 5 years ago
Edited 5 years ago
01local Players = game:GetService("Players")
02local character = Players.LocalPlayer.Character
03if not character then
04    character = Players.LocalPlayer.CharacterAdded:Wait()
05end
06 
07local humanoid = character:WaitForChild("Humanoid")
08 
09local walkAnim = Instance.new("Animation")
10walkAnim.AnimationId = "rbxassetid://4547055626"
11 
12local walkAnimTrack = humanoid:LoadAnimation(walkAnim)
13 
14walkAnimTrack:GetMarkerReachedSignal("FootStep"):Connect(function(paramString)
15    -- Perform desired action such as playing a custom footstep sound
16    print(paramString)
17end)

I need help, ¿what's wrong?

0
Is the animation owned/published by the owner of the game or to the group(if a group game)? Torren_Mr 334 — 5y
0
I'm the owner of this animation. BryanDarielGamer 1 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Looks like you forgot to play the animation track. For the GetMarkerReachedSignal connection to work, the animation must reach the marker, so it has to be played. Calling the track should work fine:

01local Players = game:GetService("Players")
02local character = Players.LocalPlayer.Character or Players.LocalPlayer.CharacterAdded:Wait()
03 
04local humanoid = character:WaitForChild("Humanoid")
05 
06local walkAnim = Instance.new("Animation")
07walkAnim.AnimationId = "rbxassetid://4547055626"
08 
09local walkAnimTrack = humanoid:LoadAnimation(walkAnim)
10walkAnimTrack:Play()
11 
12walkAnimTrack:GetMarkerReachedSignal("FootStep"):Connect(function(paramString)
13     -- Perform desired action such as playing a custom footstep sound
14    print(paramString)
15end)
0
How can i do animation stop when player stop walk? BryanDarielGamer 1 — 5y
Ad

Answer this question