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?
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).
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.
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.)
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()
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)