My value / repeat script that spins a motor turns on, but only keeps turning on and the motor spins faster. I have tried using a number value but it still will not work. I don't know if it is the repeat scripts that are interfering but here is the script for anybody who is willing to help:
local main = script.Parent.Main
local switches = script.Parent.Switches
local engine = script.Parent.Engine
switches.Click.ClickDetector.MouseClick:Connect(function(Spin)
local State = 0
if State == 0 then
switches.On.Transparency = 0
switches.Off.Transparency = 1
State = 0
for On = 1, 5 do
wait(0.5)
engine.HingeConstraint.AngularVelocity = engine.HingeConstraint.AngularVelocity + 1
end
else
switches.On.Transparency = 1
switches.Off.Transparency = 0
State = 0
for Off = 1, 5 do
wait(0.5)
engine.HingeConstraint.AngularVelocity = engine.HingeConstraint.AngularVelocity - 1
end
end
end)
Any help appreciated! :)
