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

How to rotate a part with tweening?

Here's the code i'm having trouble on.

local tweenService = game:GetService("TweenService")
local part = script.Parent

local tweeningInformation = TweenInfo.new(
	5,
	CFrame.Angles(math.rad(1),math.rad(0),math.rad(0))
	0,
	false,
	0
)

I simply want a part to rotate for five seconds and then stop.

5 comments

0

have u tried using a for loop

0

not yet

0

wait so what's the problem though also CFrame.Angles(math.rad(180),math.rad(0),math.rad(0))

0

it gives me an error.

0

the radian equivalent of 0 degrees is still 0, there is no point in changing from 0 deg. to 0 rad.

1 answer

✓ Accepted answer

Oh okay didn't think this was the whole script lol it should be

local tweenservice = game:GetService("TweenService")
local tweengoal = {}
local part = script.Parent
local rad = math.rad

local tweeningInformation = TweenInfo.new(
  5, -- Time
	Enum.EasingStyle.Linear, 
	Enum.EasingDirection.Out, 
	-1, 
	false, 
	0
)

tweengoal.Orientation = Vector3.new(0,0,180)
local tween = tweenservice:Create(part, tweeninginformation, tweengoal)
tween:Play()				

3 comments

0

alright, i'll test

0

It don't work, it gives me this error: "TweenInfo.new third argument expects Enum.EasingDirection input"

0

okay fixed

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