How to change the orientation of a part while an animation is playing and when to

I’m trying to change it, but something seems not to work

local tw = TS:Create(Sword,2, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0, Vector3.new(0,0,0))

1 Like
local newInfo = TweenInfo.new(2 ,Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)

local tw = TS:Create(Sword.Position, newInfo, Vector3.new(0,0,0))

TweenService:Create(Instance, TweenInfo, Array) takes three arguments you must include.
Instance → Decides what instance this is actually happening to, in your case ‘Sword’.
TweenInfo → Information about the Tween, for example the Time, EasingDirection, EasingStyle, etc. To get this, use TweenInfo.new(Time, EasingStyle, EasingDirection, ...). It is important to note that each of the arguments has a default value, which I’ll list below:

Time -> 1.0 -- 1 second
EasingStyle -> Enum.EasingStyle.Quad -- 'Quad' EasingStyle
EasingDirection -> Enum.EasingDirection.Out -- 'Out' Easing Direction
RepeatCount -> 0 -- Repeats 0 times
Reverses -> false -- Does not go back on itself after the Tween completes
DelayTime -> 0 -- Amount of time before the Tween actually starts

If your value is not different to the default, there is no need to fill it in. In your case, the appropriate TweenInfo is as follows:

TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingStyle.In)

Array → This is a dictionary of properties that will change during your Tween. In your case, you will want to use {Orientation = Vector3.new(0, 0, 0)}.

Overall, you want your created Tween to be the following:

--:// Services
local TweenService = game:GetService('TweenService')

--:// Constants
local Sword = path.to.sword

--:// Variables
local TweenInfoVariable = TweenInfo.new(2, Enum.EasingStyle.Liner, Enum.EasingDirection.In)
local PropertyTable = {Orientation = Vector3.new(0, 0, 0)

--:// Tweening
local Tween = TweenService:Create(Sword, TweenInfoVariable, PropertyTable)
Tween:Play()

Hope this helps!

1 Like