Basically I am making a rotor, you press the button and a motor object makes the rotor head rotate in the left or right direction. I would like for the motor to rotate continuously, but after a while it stops.
local base=script.Parent
local spinny = script.Parent.Parent.Spinny
local speed=(((math.pi*2)/60)/2)
local bl= script.Parent.Parent.ButtonLeft
local br=script.Parent.Parent.ButtonRight
local right=false
local left=false
local runningc=script.Parent.Parent.Running
local offc=script.Parent.Parent.Off
local motor=Instance.new("Motor", base)
motor.Part0=base
motor.Part1=spinny
motor.MaxVelocity=speed
motor.C0=CFrame.new(0, 0, -2.5)
-- -z -x, -y
bl.ClickDetector.MouseClick:connect(function()
if left==false then
left=true
right=false
bl.BrickColor= runningc.Value
br.BrickColor= offc.Value
elseif left==true then
left=false
right=false
bl.BrickColor=offc.Value
br.BrickColor=offc.Value
end
end)
br.ClickDetector.MouseClick:connect(function()
if right==false then
right=true
left=false
br.BrickColor= runningc.Value
bl.BrickColor= offc.Value
elseif right==true then
left=false
right=false
bl.BrickColor=offc.Value
br.BrickColor=offc.Value
end
end)
while true do
wait()
if left==true then
motor.DesiredAngle=motor.CurrentAngle + math.rad(10)
elseif right==true then
motor.DesiredAngle=motor.CurrentAngle - math.rad(10)
else
motor.DesiredAngle=motor.CurrentAngle
end
end
Thanks for any help.

3 comments
you got any loops? and maybe try a "repeat until" loop. So it repeats spining or whatever till the button is clicked to turn it off
Commenting because I scripted a motor to test this and I encountered the same problem. I did lots of googling and searching for help on this issue but couldn't find any. I'm also trying to solve this! Will update if I find anything useful
I will try the loop idea out. Also maybe to help with the testing, I notice that if you increase the ammount that you add to the desiredangle, it increases how long the motor will continue to spin. I tried math.huge, but then it didn't work at all.