Urgent help with script KeyFrameReached/GetMarkerReachedSignal is not a member of AnimationTrack

So i am currently working on a fighting game which used KeyFrameReached to find a certain keyframe in my animations to activate a function that would make a hitbox that would make damage and continue with the combo but i cant get it to work without that part of the script i have tried using GetMarkerReachedSignal but i cant get it to work so i ask for help here. The issue i am having is at line 77 or…

punchTrack.KeyFrameReached:Connect(function(frame)
			if frame == "Damage" then
				hitTarget = createHitbox(Vector3.new(3, 3, 3), character.PrimaryPart.CFrame * CFrame.new(0, 0, -3), { character })
				punchRe:FireServer(hitTarget, character, hitNum)
				
				if hitNum == #punchAnims then
					hitNum = 1
				else
					hitNum *= 1
				end

The other part of the script it self (not the full script tho).

local function createHitbox(size, offset, ignore)
	local hitbox = Instance.new("Part", character)
	
	hitbox.Size = size
	hitbox.CFrame = offset
	hitbox.CanCollide = false
	hitbox.CanQuery = false
	hitbox.Transparency = 0
	hitbox.Anchored = true
	
	local hitConn
	hitConn = hitbox.Touched:Connect(function()
		hitConn:Disconnect()
	end)
	
	local target = nil
	
	for i, v in pairs(hitbox:GetTouchingParts()) do
		if v.Parent:FindFirstChild("Humanoid") and table.find(ignore, v.Parent) == nil then
			if (target.PrimaryPart.Position - character.PrimaryPart.Position).Magnitude > (v.Parent.PrimaryPart.Position - character.PrimaryPart.Position).Magnitude then
				target = v.Parent
			end
		else
			target = v.Parent
		end
	end
	
	game.Debris:AddItem(hitbox, 0.1)
	
	if target then
		return target
	else
		return nil
	end
end

local function punch(actionName, inputState, inputType)
	if inputState == Enum.UserInputState.Begin and canPunch then
		canPunch = false
		
		if tick() - lastPunch > 1 then
			combo = 1
			hitNum = 1
		end
		
		lastPunch = tick()
		
		local animation = Instance.new("Animation", character)
		animation.AnimationId = punchAnims[combo]
		animation:Destroy()
		
		local punchTrack = humanoid.Animator:LoadAnimation(animation)
		punchTrack:Play()
		
		local hitTarget = nil
		
		punchTrack.KeyFrameReached:Connect(function(frame)
			if frame == "Damage" then
				hitTarget = createHitbox(Vector3.new(3, 3, 3), character.PrimaryPart.CFrame * CFrame.new(0, 0, -3), { character })
				punchRe:FireServer(hitTarget, character, hitNum)
				
				if hitNum == #punchAnims then
					hitNum = 1
				else
					hitNum *= 1
				end
			end
		end)
		
		if combo == #punchAnims then
			combo = 1
			
			wait(1)
			canPunch = true
		else
			combo *= 1
			
			wait(.25)
			canPunch = true
		end
	end
end
2 Likes

I would recommend relying off of GetMarkerReachedSignal over KeyframeReached as it is the most up to date method, and also DOUBLE TRIPLE check your KeyFrameName is “Damage” exactly, that is probably where the issue resides.

1 Like

I have already tried using GetMarkerReachedSignal since KeyFrameReached became obsolete and no longer works but i do not get how i add a marker to a specific keyframe of my animation unless it does not work like that… And yes i have already DOUBLE TRIPLE checked my keframe name is “Damage”. I could send more images or more details if needed too.

1 Like

Send a photo of the animation editor. It should have Damage as a named keyframe. If you have that, I would like you to print the line before and after using GetMarkerReachedSignal to confirm that the issue is indeed one of those methods, which it most likely won’t be.

1 Like


This is the keyframe where the script should create the hitbox.

Integrate GetMarkerReachedSignal into your code and print on the line before and after. See what the console says.

2 Likes


Here is the other ss about the print before the issue. And let me try out the GetMarkerReachedSignal but in between which lines do i place the GetMarkerReached signal line tho?

1 Like

First, the F is lowercase, KeyframeReached. Second, I would recommend switching KeyframeReached out with GetMarkerReachedSignal. It is very similar, except you do this:

punchTrack:GetMarkerReachedSignal("Damaged"):Connect(function()

end)


So it ended up fixing where the animation would only play once but now i can do it multiple times with no errors but the hitbox is missing…

Try printing inside the function, there is probably an issue with your createHitbox method.


“Create hitbox” did not print tho.

Weird, are you sure that keyframe was reached?

How would i know the GetMarkerReachedSignal is the one that should check when its reached.

Yes, it tells you when. But is the full animation playing uninterrupted?

Well it does not tell me or i just do not know where to look at where it says but yes the animation fully plays no interruptions.

And you are sure this is the animation with the KeyframeMarker? Try reuploading the animation and putting it’s ID as the one to play.

1 Like

I do not have any keyframeMarker added to any animation since i dont know how… But let me try reuploading the animation.

Nothing changed when reuploading the animation.

Oh my maybe its that let me try it. Thanks.