'new' is not a valid member of TweenInfo

Hi there! I’m getting a really odd error which tells me ‘new’ is not a valid member of TweenInfo, which I’m 99% certain it is…

Code
local TweenService = game:GetService("TweenService")
local Object = script.Parent

local TweenInfo = TweenInfo.new( -- does not error here
	2,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	-1,
	false,
	0
)

local Tween = TweenService:Create(Object, TweenInfo, {Rotation = 360})
Tween:Play()

local Background = script.Parent.Parent
local BackTweenInfo = TweenInfo.new( -- line for the error
	1,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.In,
	0,
	false,
	0
)

local BackTween = TweenService:Create(Background, BackTweenInfo, {Position = {0.5, 0},{-5, 0}})
wait(6)
BackTween:Play({0.5, 0},{-5, 0})
1 Like

you’re calling your own variable, try

local TweenService = game:GetService("TweenService")
local Object = script.Parent

-- yes
local info = TweenInfo.new( -- does not error here
	2,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	-1,
	false,
	0
)

local Tween = TweenService:Create(Object, info, {Rotation = 360})
Tween:Play()

local Background = script.Parent.Parent
local BackTweenInfo = TweenInfo.new( -- line for the error | because the previous variable's name is the TweenInfo constructor
	1,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.In,
	0,
	false,
	0
)

local BackTween = TweenService:Create(Background, BackTweenInfo, {Position = UDim2.new(.5, 0, -5, 0)}) -- you: {0.5, 0},{-5, 0}
wait(6)
BackTween:Play({0.5, 0},{-5, 0}) -- wait what, do tween play functions can handle arguments?
1 Like

not sure if I’m correct but why is your Position like that? isn’t it supposed to be Vector3? or Vector2?, that could be the problem maybe try changing that

1 Like

it’s UDim2 sir…


1 Like

yea i don’t think that’s how you tween an UDIM2

me too… lol