Unable to cast double to TweenInfo

I’m trying to make a non-collidable part spin around.

Error is on line 11 and i don’t understand what its trying to tell me.

local TS = game:GetService('TweenService')
local timeItTakes = 1
local tweenInfo = (timeItTakes)

local ball = script.Parent
local spinSpeed = 1.5

while true do
	local spinGoal = ball.CFrame --* CFrame.Angles(spinSpeed*math.random(1,2),spinSpeed*math.random(1,2),spinSpeed*math.random(1,2))    commented out to test if this was the issue

	local tweenItUp = TS:create(ball, tweenInfo, { CFrame = (spinGoal) } )

	tweenItUp:Play()
	
	task.wait(timeItTakes)
end

you’re supposed to create a tween info, this one here is just giving a raw number that doesn’t hold any info for tweens to play, the second param is expecting that.

local TS = game:GetService('TweenService')
local timeItTakes = 1
local tweenInfo = TweenInfo.new(timeItTakes)

local ball = script.Parent
local spinSpeed = 1.5

while true do
	local spinGoal = ball.CFrame --* CFrame.Angles(spinSpeed*math.random(1,2),spinSpeed*math.random(1,2),spinSpeed*math.random(1,2))    commented out to test if this was the issue

	local tweenItUp = TS:create(ball, tweenInfo, { CFrame = (spinGoal) } )

	tweenItUp:Play()
	
	task.wait(timeItTakes)
end

thank you aa. i wish the error was more clear

there’s a reason why autocomplete exists!
you can check what parameter type is it accepting in the method you’re calling as this pic here

e.g if you use angle and it accepts number, you can type a number

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