Hello I was able to make this rotate but its always resetting it to the default value, is there a way to make this script smoothly tween and loop perfectly?
local tweenService = game:GetService("TweenService")
local changes = {
C0 = motor.C0 * CFrame.Angles(0,math.rad(180),0)
}
local tweenInfo = TweenInfo.new(
2, -- Time taken for a full animation
Enum.EasingStyle.Quad, -- Animation Style
Enum.EasingDirection.InOut, -- Animation Type
-1, -- Number of repeats (-1 is infinite)
false, -- Reverse?
0-- Delay between animations
)
local tween = tweenService:Create(motor, tweenInfo, changes)
tween:Play()
local tweenService = game:GetService("TweenService")
local changes1 = {
C0 = motor.C0 * CFrame.Angles(0,math.rad(180),0)
}
local changes2 = {
C0 = motor.C0 * CFrame.Angles(0,math.rad(360),0)
}
local tweenInfo = TweenInfo.new(
2, -- Time taken for a full animation
Enum.EasingStyle.Quad, -- Animation Style
Enum.EasingDirection.InOut, -- Animation Type
-1, -- Number of repeats (-1 is infinite)
false, -- Reverse?
0-- Delay between animations
)
local tween1 = tweenService:Create(motor, tweenInfo, changes1)
local tween2 = tweenService:Create(motor, tweenInfo, changes2)
tween1:Play()
tween2:Play()
I don’t know what I was really thinking about when doing this…
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local angle = Instance.new("NumberValue")
local tweenInfo = TweenInfo.new(
1, -- Time taken for a full animation
Enum.EasingStyle.Linear, -- Animation Style
Enum.EasingDirection.InOut, -- Animation Type
-1, -- Number of repeats (-1 is infinite)
false, -- Reverse?
0-- Delay between animations
)
RunService.Heartbeat:Connect(function()
motor.C0 = CFrame.new(motor.C0.Position) * CFrame.Angles(0, math.rad(angle.Value), 0)
end)
TweenService:Create(angle, tweenInfo, {
Value = 360;
}):Play();