Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make this rotate faster?

Asked by 8 years ago

Can anyone tell me how to make this rotate faster? this whole script work's fine beside's it rotating to slow.

local label = script.Parent.DropLabel

script.Parent.SelectorStart.MouseButton1Click:connect(function()
    for i = 1, 90 do
        label.Rotation = label.Rotation + 1
        wait(0)
    end
end)

1 answer

Log in to vote
0
Answered by
Redbullusa 1580 Moderation Voter
8 years ago

Add more increments, but with less iterations.

90 x 1 == 90, of which is your end goal.

for i = 1, 90 do
    label.Rotation = label.Rotation + 1
    wait()
end

45 x 2 == 90; twice as fast, same result.

for i = 1, 45 do
    label.Rotation = label.Rotation + 2
    wait()
end

30 x 3 == 90; thrice as fast, same result.

for i = 1, 30 do
    label.Rotation = label.Rotation + 3
    wait()
end

If you're using a local script, you could implement RenderStepped:wait().

RS = game:GetService("RunService")
-- function opens
for i = 1, 90 do
    label.Rotation = label.Rotation + 1
    RS.RenderStepped:wait()
end
-- function closes

The loop will iterate the next time the frame changes.

0
Would make it look extremely choppy. User#5978 25 — 8y
Ad

Answer this question