Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

¿Why my walk animation don't play?

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?

2 comments

0

Is the animation owned/published by the owner of the game or to the group(if a group game)?

0

I'm the owner of this animation.

1 answer

✓ Accepted answer

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)

1 comment

0

How can i do animation stop when player stop walk?

This discussion is preserved as it was. New answers, comments, and votes are closed.