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

How can I make a loop that keeps rotating a part but everytime the loop starts number will decrease?

Asked by 3 years ago
Edited 3 years ago

Hey guys,

I know the title is confusing but it's really the best way I can explain. So I have a wheel that spins(keeps rotating) via changing it's CFrame angle, It's in a loop and I want to it slowly decrease it's rotation speed everytime the loop is done and it starts again.

Here's the script:

while wait() do
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(8.5,0,0)
end

If you didn't understand, I basically want the script be like this:

script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(8.5,0,0)
wait(0.1)
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(8.4,0,0)
wait(0.1)
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(8.3,0,0) --and it keeps going like that till it reaches to 0
0
Hm I dont really know Im a beginner myself but I think it involves something with for count EthanWithHyper 0 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

Hope this works :)

local x = 8.5 -- Starting value
while true do
    script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(x,0,0)
    x -= 0.1
    wait()
end
0
Thank you so much! Va1t_Dev 86 — 3y
Ad

Answer this question