Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

1 comment

0

Hm I dont really know Im a beginner myself but I think it involves something with for count

1 answer

✓ Accepted answer

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

1 comment

0

Thank you so much!

This discussion is preserved as it was. New answers, comments, and votes are closed.