Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Rotate With Tween Service?

Asked by 3 years ago

Is It Possible to Use Tween Service To Rotate Blocks?

1 answer

Log in to vote
0
Answered by 3 years ago

Yes. There's 2 options. A: Using CFrame. I recommend using CFrame for a multiple of reasons. CFrame takes position and orientation (or rotation) into account. So you can just do this:

local tweenService = game:GetService("TweenService")
local tween = tweenService:Create(workspace.Part, TweenInfo.new(
    2, --time to complete goal
    Enum.EasingStyle.Quint,
    Enum.EasingDirection.Out,
    0, --times repeating
    false, --reverse tween
    0 --Delay time
), {CFrame = workspace.Part.CFrame * CFrame.Angles(0,math.rad(90),0)} )

(Note: To use CFrame.Angles(), you need to turn degrees into radians. So use math.rad()). B: Using Orientation I wouldn't recommend this method because it's a bit clunky, but some people use it, so it's the same thing, here you go:

local tweenService = game:GetService("TweenService")
local tween = tweenService:Create(workspace.Part, TweenInfo.new(
    2, --time to complete goal
    Enum.EasingStyle.Quint,
    Enum.EasingDirection.Out,
    0, --times repeating
    false, --reverse tween
    0 --Delay time
), {Orientation = Vector3.new(0,180,0)} )

Remember that the goal (3rd parameter of TweenService:Create()) needs to have named properties, and make sure you correctly name them. You can manipulate any property to suit its needs, so long as you define it.

0
Thank You! bensinsaus2 2 — 3y
Ad

Answer this question