Door Rotation not fast enough; for loop too slow


I am trying to speed up the rotation on rotating a door 90 degrees. To open the door, I am using a for loop for every degree, and then waiting a delay in-between, which is defined by a variable. However, even if I put the delay on the lowest number possible, it still opens quite slowly. I’m not sure how to counteract this issue and any help would be appreciated.

Also, I’ve already tried removing the delay and it will just open instantly.

for i = 1, degree do
    door.CFrame = * 
    CFrame.Angles(0,math.rad(i)+math.rad(hinge.Orientation.Y), 0) *, 0, 0)
    wait(timedelay) -- variable is currently set to 0.0001
1 Like

the lowest a wait() can go is 0.03 seconds.

1 Like

Useful to know, the variable will automatically set itself to that thus I’m still going to have the issue however.

Yes, this is because of how the Task Scheduler works you can wait() for a minimum of 0.03 seconds. Instead you should be using TweenService to handle this movement. This would let you get rid of a the for loop.

1 Like