Tweening speed for rotating an object is all over the place

i was messing with rotating off a pivot and i tried rotating a part off some pivot 360 degrees with a tween

unfortunately it didnt work and now it starts accelerating and going way past the time i set

im not sure why this happens, its happened before when i tried tweening to rotate an object but i cant find any topic on it, last time this happened i was changing a parts orientation property to rotate it and i switched to its cframe and it started working oddly enough

heres my script, its on the server and in a base part if thats useful

 local part = script.Parent

local tweenService = game:GetService("TweenService")

part.PivotOffset = (CFrame.new(0,-part.Size.Y/2,0) * part.PivotOffset.Rotation)

local info = TweenInfo.new(0.3, Enum.EasingStyle.Linear, Enum.EasingDirection.In)

local cframe = Instance.new("CFrameValue")

local rotation1 = tweenService:Create(cframe, info, {Value = CFrame.Angles(math.rad(120),0,0)})
local rotation2 = tweenService:Create(cframe, info, {Value = CFrame.Angles(math.rad(240),0,0)})
local rotation3 = tweenService:Create(cframe, info, {Value = CFrame.Angles(math.rad(360),0,0)})


cframe.Changed:Connect(function()
	part:PivotTo(part:GetPivot() * cframe.Value)
end)

rotation1.Completed:Connect(function()
	rotation2:Play()
end)

rotation2.Completed:Connect(function()
	rotation3:Play()
end)

rotation3.Completed:Connect(function()
	rotation1:Play()
end)

rotation1:Play()

and heres a video of what happens when running the game using this script

(reminder that the time is 0.3, even if i were to set it to some crazy high number like 100 it starts accelerating

this is my first topic so hoping it included enough, any help would be appreciated, even just a response since im losing my mind

1 Like

fixed it, the problem was just since i was constantly adding on these angles to the parts rotation after every change, sorry for the trouble, some other issues, all in all this is the code that worked

local part = script.Parent

local position = part.Position

local tweenService = game:GetService("TweenService")

part.PivotOffset = (CFrame.new(0,-part.Size.Y/2,0) * part.PivotOffset.Rotation)

local info = TweenInfo.new(0.3, Enum.EasingStyle.Linear, Enum.EasingDirection.In)

local cframeValue = Instance.new("CFrameValue")

local rotation1 = tweenService:Create(cframeValue, info, {Value = CFrame.Angles(math.rad(120),0,0)})
local rotation2 = tweenService:Create(cframeValue, info, {Value = CFrame.Angles(math.rad(240),0,0)})
local rotation3 = tweenService:Create(cframeValue, info, {Value = CFrame.Angles(math.rad(360),0,0)})


cframeValue.Changed:Connect(function()
	local cframe = CFrame.new(position)
	part:PivotTo(cframe * cframeValue.Value)
end)

rotation1.Completed:Connect(function()
	rotation2:Play()
end)

rotation2.Completed:Connect(function()
	rotation3:Play()
end)

rotation3.Completed:Connect(function()
	rotation1:Play()
end)

rotation1:Play()

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.