I’m trying to tween a Motor6D’s C0 CFrame but it keep resulting an error: [Unable to cast value to Object]
function TweenC0(Motor, EndCF)
local prop = {CFrame = EndCF}
local info = TweenInfo.new(0.1,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
return TweenService:Create(Motor, info, prop)
end
TweenC0(Motor6D.C0, CFrame.new(0,1,0))
I know I can use CFrame.lerp, however I want to use TweenService in my scenario, seems that there’s something wrong with the tween function?
TweenService:Create first argument requires an instance to tween.
The third argument, the property table, should be a mapping of property keys to goal values.
local function TweenC0(Motor, EndCF) -- always use local variables, TweenC0 has been made local
local prop = {C0 = EndCF}
local info = TweenInfo.new(0.1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
return TweenService:Create(Motor, info, prop)
end
local tween_instance = TweenC0(Motor6D, CFrame.new(0, 1, 0)