How can I prevent adding to the rotation? Only prevents if I reset to the default but I dont want that, and I need help fixing.
local speed = .1
local tick = .5
local motor = script.Parent
motor.MaxVelocity = speed
if script:FindFirstChild("Default") == nil
then
local def = Instance.new("CFrameValue")
def.Name = "Default"
def.Value = motor.C0
def.Parent = script
end
local def = script:FindFirstChild("Default")
--Rotation,Time,Direction--
local draw = {
{0, 0, 0},
{-180, .5, 30},
{-30, .5, 30}
}
--Problem Line
function play(ani)
last = math.rad(0)
for a = 1, #ani do
num = a
angle = tonumber(ani[num][1])
motor.DesiredAngle = math.rad(angle)
ang = math.rad(ani[num][3])-last
motor.C0 = motor.C0*CFrame.Angles(0,ang-last,0)
last = ang
wait(ani[num][2])
end
end
----
motor.C0 = script.Default.Value
play(draw)
