"Attempt to call a TweenInfo value" error

Hello, I’m currently trying to make my own TweenService, and everything looks fine. But then something came up.

This has to be more than likely one of the most less descriptive and confusing errors I’ve ever gotten through Roblox’s studio platform. The error seems to be coming from here:

Does anyone have any ideas on why this is happening? Don’t question why I’m trying to make my own TweenService. The main problem here is why is it “attempt to call a TweenInfo value”.

This is in the TweenServcie modulescript by the way, here’s the entire code.

local module = {
	Tweens = {};
}

function module:Create(object, result, interval, eS, eD, repeatCount, reverses, delayCount)
	eS = eS or "Linear"
	eD = eD or "Out"
	repeatCount = repeatCount or 0
	reverses = reverses or false
	delayCount = delayCount or 0;
	
	local tweenService = game:GetService("TweenService");
	local tween;
	
	if interval == nil then error("You must set a specific interval for tween, but you put nil instead."); return; end
	if object == nil then error("You must set a specific object to tween."); return; end
	if result == nil then error("You must give a result as a dictionary for tween."); return; end
	
	if not Enum.EasingStyle[eS] then errorf("Invalid EasingStyle %s.", eS); return; end
	if not Enum.EasingDirection[eD] then error("Invalid EasingDirection %s.", eD); return; end
	local f
	local n
	
	for i, v in pairs(result) do
		f = i
		n = v
		break;
	end
	
	tween = tweenService:Create(object, TweenInfo.new(interval, Enum.EasingStyle[eS], Enum.EasingDirection[eD], repeatCount, reverses, delayCount) {f = n});
	
	return tween;
end

function module:Start(object, result, interval, eS, eD, repeatCount, reverses, delayCount)
	eS = eS or "Linear"
	eD = eD or "Out"
	repeatCount = repeatCount or 0
	reverses = reverses or false
	delayCount = delayCount or 0;
	
	local tweenService = game:GetService("TweenService");
	local tween;
	
	if interval == nil then errorf("You must set a specific interval for tween, but you put %s instead.", object.Name); return; end
	if object == nil then error("You must set a specific object to tween."); return; end
	if result == nil then error("You must give a result as a dictionary for tween."); return; end
	
	if not Enum.EasingStyle[eS] then errorf("Invalid EasingStyle %s.", eS); return; end
	if not Enum.EasingDirection[eD] then errorf("Invalid EasingDirection %s.", eD); return; end
	local f
	local n
	
	for i, v in pairs(result) do
		f = i
		n = v
		break;
	end
	
	tweenService:Create(object, TweenInfo.new(interval, Enum.EasingStyle[eS], Enum.EasingDirection[eD], repeatCount, reverses, delayCount) {f = n}):Play();
end

function errorf(str, ...)
	error(string.format(str, ...))
end



return module
1 Like

Looks to be missing a comma before the {f = n} part near the end of that. Should be 3 arguments, yes?

9 Likes

I know its too late but you forgot the ,
image

1 Like