How do I get the length of a CurveAnimation?

I dug through the documentation for over 20 minutes and I don’t think I found any property or function that can directly tell me how long one is.

I’ve had this problem before, but I managed to find a topic that would help with it, but I don’t know if it’s still active

Link to it if you think it’ll help.

local function GetCurveAnimationTime(Animation)
	local Max = 0

	for _, obj in Animation:GetDescendants() do
		if obj.ClassName == "FloatCurve" then
			local Keys = obj:GetKeys()

			for _, obj in pairs(Keys) do
				Max = math.max(Max, obj.Time)
			end
		end
	end

	return Max
end
1 Like

Thanks. Better than having to LoadAnimation just to get the .Length

1 Like