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 4 years ago
Edited 4 years ago
local Players = game:GetService("Players")
local character = Players.LocalPlayer.Character
if not character then
    character = Players.LocalPlayer.CharacterAdded:Wait()
end

local humanoid = character:WaitForChild("Humanoid")

local walkAnim = Instance.new("Animation")
walkAnim.AnimationId = "rbxassetid://4547055626"

local walkAnimTrack = humanoid:LoadAnimation(walkAnim)

walkAnimTrack:GetMarkerReachedSignal("FootStep"):Connect(function(paramString)
    -- Perform desired action such as playing a custom footstep sound
    print(paramString)
end)

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 — 4y
0
I'm the owner of this animation. BryanDarielGamer 1 — 4y

1 answer

Log in to vote
0
Answered by 4 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:

local Players = game:GetService("Players") 
local character = Players.LocalPlayer.Character or Players.LocalPlayer.CharacterAdded:Wait()

local humanoid = character:WaitForChild("Humanoid")

local walkAnim = Instance.new("Animation")
walkAnim.AnimationId = "rbxassetid://4547055626"

local walkAnimTrack = humanoid:LoadAnimation(walkAnim)
walkAnimTrack:Play()

walkAnimTrack:GetMarkerReachedSignal("FootStep"):Connect(function(paramString)
     -- Perform desired action such as playing a custom footstep sound 
    print(paramString)
end)
0
How can i do animation stop when player stop walk? BryanDarielGamer 1 — 4y
Ad

Answer this question