Help with slowing down a Script

Hi!

I want a Part to rotate around this Submarine, and I have encased the Submarine in another part.
I have the script below, which is a child of the rotating part:

local angle = 10
 
while wait() do

    script.Parent.CFrame = CFrame.new(target.Position)   
                           * CFrame.Angles(0, angle, 0) 
                           * CFrame.new(0, 0, -230)       
    angle = angle + math.rad(10)
end

However, this goes… really fast.

I’d like it to slow down to a moderate pace, so it doesn’t hurt peoples eyes…!

How can I edit my script?

Thanks, AridOats.

1 Like

CFrame can be costly if you use a lot of these, if there’s a way to use hinge constraints with motor actuators I’d advise it,

however for this script you can increase the wait() time to something like (.25), which might cause it to appear as if it’s stuttering. Or, you can decrease the value within math.rad.
If that doesn’t work it means I can’t read, if that happens change ‘-230’ insted.

Decreasing the math.rad did the trick perfectly, thankyou!

1 Like