Ok, so KeyFrameReached is working as intended, but the code tied to the keyframes isn't

Connections:

Anim_List[I].Connections = Loaded_Tracks.Tracks[I].Stopped:Connect(function()
					KeyReach("End",I,Plr)
					Anim_List[I].Connections:Disconnect()
					Anim_List[I].Connections = nil
					Stop(I)
				end)
				Loaded_Tracks.Conn[I] = Loaded_Tracks.Tracks[I].KeyframeReached:Connect(function(Frame) 
					if Frame ~= "End" then
						Hum.DisplayName = Frame
						KeyReach(Frame,I,Plr)
					end
					if Frame == "End" then
						Hum.DisplayName = ""
						Loaded_Tracks.Conn[I]:Disconnect()
						Loaded_Tracks.Conn[I] = nil
					end
				end)

Function:

function KeyReach(Key,Track,P)
	if Key == "End" or Loaded_Tracks.Tracks[Track].Stopped then
		if emoteNames[Track] == nil or emoteNames[Track] == true then
			Set_Anim(Track)
		end
	elseif Key == "Damage" then
		if P then
			print(P.Name)
			if table.find(workspace:GetPartsInPart(Figure.PrimaryPart.HitBox,Filter),P.PrimaryPart) then
				P.Humanoid.Health -= 30
			end
		end
	elseif Key == "Step" or Key == "Step_2" then
		StepSound:Stop()
		Randomize_Eq()
		StepSound:Play()
	end
end

Video Evidence:

So apparently the order matters, as when I put the part for Key == “End” at the end, everything worked

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.