How to make Tween Service rotate my part by 360 degrees

I want script that will rotate my part by 360 degrees, i made one, but when i try to change it to 360 its don’t work at all. I don’t get any errors so i don’t know how to fix it.

Heres script:

local ts = game:GetService("TweenService")
local part = script.Parent
local info = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out,-1)
local properties = {CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(360),0)}

local tween = ts:Create(script.Parent,info,properties)

tween:Play()

What should i change to make it rotate my part by 360 degrees?

27 Likes

Rotate it by 180 degrees and then rotate it again by 180 degrees. It is working but when you’re tweening it just finds the fastest way to tween. If you would rotate it by 270 degrees then it’d rotate by 90 degrees (because 360-270=90<270).

3 Likes

how can i make it rotate again 180 degrees?

1 Like

You can just play the tween twice, but you’ll have to wait until the first one is finished. Either you could wait for the duration of the tween, or you could listen for the Tween.Completed event.

1 Like

By chaning math.rad(360) to math.rad(180) you will be constantly adding 180 degrees to the part as your tween is infinte, this will fix your issue. Your previous code didn’t work as you were multipling the parts CFrame by 360 (or 0).

(Note: you might want to cut your tween time in half to achieve the original time.)

4 Likes

i don’t know why but im getting this result
https://gyazo.com/fbb677177782169ede3ec8588798efd4

1 Like

how to fix this? i want it to make a full circle

1 Like
local ts = game:GetService("TweenService")
local part = script.Parent
local info = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out,-1)
local properties = {CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(180),0)}
local tween = ts:Create(script.Parent,info,properties)
tween:Play()
wait(5)
tween:Play()
4 Likes

i don’t know why but im still getting the result as above

1 Like

Try this:

local ts = game:GetService("TweenService")
local t1 = ts:Create(script.Parent, TweenInfo.new(2.5, Enum.EasingStyle.Linear), {CFrame = script.Parent.CFrame * CFrame.Angles(0, math.pi, 0)})
local t2 = ts:Create(script.Parent, TweenInfo.new(2.5, Enum.EasingStyle.Linear), {CFrame = script.Parent.CFrame * CFrame.Angles(0, math.pi, 0)})

while true do
    t1:Play()
    t1.Completed:Wait()
    t2:Play()
    t2.Completed:Wait()
end

Some things to note:

  • The -1 passed as the Repeat count argument for TweenInfo repeats the tween indefinitely
  • math.pi is equivalent to 180 degrees
1 Like

Why don’t you try rotating it by 90 degrees everytime

dang been looking this for a while it completely works. I used 120 degrees instead since its faster

TweenService = game:GetService("TweenService")
spininfo = TweenInfo.new(2,Enum.EasingStyle.Linear)

Spin1 = TweenService:Create(script.Parent,spininfo,{CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(120),0)})
Spin2 = TweenService:Create(script.Parent,spininfo,{CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(240),0)})
Spin3 = TweenService:Create(script.Parent,spininfo,{CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(360),0)})

Spin1:Play()
Spin1.Completed:Connect(function()Spin2:Play() end)
Spin2.Completed:Connect(function()Spin3:Play() end)
Spin3.Completed:Connect(function()Spin1:Play() end)
84 Likes

local ts = game:GetService(“TweenService”)
local part = script.Parent
local info = TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out,)
local properties = {CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(1),0)}

local tween = ts:Create(script.Parent,info,properties)

tween:Play()