Tween C1 of a motor

  1. What do you want to achieve?
    I want to know if it is possible to Tween the C1 property of a Motor6D.
  2. What is the issue? Include screenshots / videos if possible!
    It will throw errors such as Unable to cast to Dictionary.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried looking at DevForum altough have not found anything that asks the same question.

Here is my current code used and called when the value of Open changes. (Not done yet, just wanted to experiment. It should change the Position value of the C1 property in a Motor6d

local TweenService = game:GetService("TweenService")
local Doors = script.Parent
local info = TweenInfo.new(0.6,Enum.EasingStyle.Cubic,Enum.EasingDirection.In,0,false,0)
local Tween = TweenService:Create(Doors.Pivot.Motor.C1,info, {Position = 0.5,0,0.3})
function Changed()
	if script.Parent.Open.Value == true then
		print("twen")
		Tween:Play()
	end
end

script.Parent.Open.Changed:Connect(Changed)

Positions are Vector3ā€™s. Vector3ā€™s are expressed by doing

Vector3.new(x,y,z)

and not by

x,y,z

Also, you can not tween CFrames as you are trying by doing with

Doors.Pivot.Motor.C1

You can only tween objects!!

So to fix your Tween

local Tween = TweenService:Create(Doors.Pivot.Motor,info, {CFrame = CFrame.new(0.5,0,0.3)})

Iā€™m pretty sure you can tween a C1, considering itā€™s a CFrame value. Correct me if Iā€™m wrong.

Instead of this,
local Tween = TweenService:Create(Doors.Pivot.Motor.C1,info, {Position = 0.5,0,0.3})
try this:

local Tween = TweenService:Create(Doors.Pivot.Motor.C1,info, {CFrame = CFrame.new(0.5,0,0.3)})

Alright, Iā€™m sorry, I am not so experienced in tweens. I am starting to learn it, thank you for telling me that you only can tween objects. I will consider your script and reply if I get any other issues.

Hello, I tried to apply your changes and it gives me an error ā€œTweenService:Create no property named ā€˜CFrameā€™ for object ā€˜Motorā€™ā€. Do you have any idea of what the problem might be?

Hello, I tried to change the script and it gives me an error ā€œUnable to cast value to Objectā€™ā€.

I found the issue, try this instead:

local Tween = TweenService:Create(Doors.Pivot.Motor,info, {C1 = CFrame.new(0.5,0,0.3)})
1 Like

Thank you so much, it all works flawless now!

1 Like

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