I'm trying to make a gate where if you click the wheel, the part would spin in place while the gate opens. The script below is separate from the script that opens the gate.
--Prototype
w = script.Parent.Parent.Wheel_Part
debounce = true
function turn()
if debounce == true then
debounce = false
for i=1,450 do
w.CFrame = CFrame.fromEulerAnglesXYZ(0,0,-.8)
wait()
end
wait(1)
for i=1,450 do
w.CFrame = CFrame.fromEulerAnglesXYZ(0,0,.8)
wait()
end
debounce = true
end
end
script.Parent.ClickDetector.MouseClick:connect(turn)

2 comments
You do realize that at the second part where I wait(1) I want the wheel to spin back to original position.
and also the wheel spins unbelievably fast....