GetMarkerReachedSignal is not a valid member of Animation

I wanted it to play footstep sounds when the event keyframe but the studio doesnt recognize GetMarkerReachedSignal for some reason, any help is appreciated!

local script:

script.Walking:GetMarkerReachedSignal("Footstep"):Connect(function()
	if footstep1 == true then
		footstep2 = true
		footstep1 = false
		SFX1:Play()
	elseif footstep2 == true then
		footstep2 = false
		footstep1 = true
		SFX2:Play()
	end
end)

local script (full if needed):

local Run = game:GetService("RunService")

local Tool = script.Parent

local player = game:GetService("Players").LocalPlayer
local char = player.Character
local humanoid = char:WaitForChild("Humanoid")


local SFX1 = script.FootstepSFX
local SFX2 = script.Footstep2SFX

local moving = false
local idle = true

local footstep1 = true
local footstep2 = false

Tool.Equipped:Connect(function()
	humanoid:LoadAnimation(script.Idle):Play()
end)

Tool.Unequipped:Connect(function()
	for i,v in pairs(humanoid:GetPlayingAnimationTracks()) do
		if v.Animation.AnimationId == script.Idle.AnimationId or v.Animation.AnimationId == script.Walking.AnimationId then
			v:Stop()
		end
	end
end)

Run.RenderStepped:Connect(function()
	if humanoid.MoveDirection.Magnitude == 0 then
		if idle == false then
			idle = true
			moving = false
			for i,v in pairs(humanoid:GetPlayingAnimationTracks()) do
				if v.Animation.AnimationId == script.Walking.AnimationId then
					v:Stop()
				end
			end
		end
		humanoid:LoadAnimation(script.Idle):Play()
	elseif humanoid.MoveDirection.Magnitude > 0 then
		if moving == false then
			idle = false
			moving = true
			for i,v in pairs(humanoid:GetPlayingAnimationTracks()) do
				if v.Animation.AnimationId == script.Idle.AnimationId then
					v:Stop()
				end
			end
			humanoid:LoadAnimation(script.Walking):Play()
		end
	end
end)

script.Walking:GetMarkerReachedSignal("Footstep"):Connect(function()
	if footstep1 == true then
		footstep2 = true
		footstep1 = false
		SFX1:Play()
	elseif footstep2 == true then
		footstep2 = false
		footstep1 = true
		SFX2:Play()
	end
end)

I don’t think normal Animation instance recognize :GetMarkerReachedSignal(). But instead, it only works if the animation has been loaded with Humanoid.

And also please make variable of your animation.

thank you it works, but now it doesnt work at all. I’ve made it print when it triggers but nothing in the command output.