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.new(hingePos) *
CFrame.Angles(0,math.rad(i)+math.rad(hinge.Orientation.Y), 0) *
CFrame.new(door.Size.X/2, 0, 0)
wait(timedelay) -- variable is currently set to 0.0001
end
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.