Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Rotate With Tween Service?

Is It Possible to Use Tween Service To Rotate Blocks?

1 answer

✓ Accepted answer

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.

1 comment

0

Thank You!

This discussion is preserved as it was. New answers, comments, and votes are closed.