Make a part spin without timeout

So I am making a drill with a moving drill head (not sure if thats the name or not).

So I used tween in a while loop that runs while the value it is attacted to is true.

I used the tween and it just didnt work.

Is there something else I can use?

Have you tried using CFrame? That Should Work Better. If you want an example i can give one.

Have you tried using TweenSequence Editor? TweenSequence Editor

With that thing you can make professional rotations etc.

Couldn’t You Use CFrames property fromEulerAnglesXYZ and get the same affect?

True, or just
while true do wait()
Part.CFrame = Part.CFrame * CFrame.Angles(math.rad(1),0,0)
end

do this

local part = script.Parent
local a = 0 
local spinning = true

repeat
part.Rotation = Vector3.new(0,a,0)
a = a+1
wait(.01)
until spinning == false

that should work fine as long as you never change “spinning” 's value to false and you put the script inside the part.

if i helped, please mark this as a solution…

That’s some hella basic script.

while true do wait()
Part.CFrame = Part.CFrame * CFrame.Angles(math.rad(1),0,0)
end

and this is basically doing same.

yeah, it’s basic, easy to understand for beginners, and works, so is there a problem?..

Not really, was just confused why ur doing it like that.

Also confused when the owner of this topic responds// marks sth as solution.

1 Like

i just wouldnt usually do it like that, but im doing it like that because im assuming he is new to scripting stuff like this because he’s using tweenservice instead of cframe or stuff like that.

Insert a script inside the part you want to spin and type this:

local runService = game:GetService("RunService")
local drill = script.Parent


runService.Stepped:Connect(function(deltaTime)

    drill.CFrame *= CFrame.Angles(0, math.rad(45) * deltaTime * 60, 0) -- If we multiply by the deltaTime and 60, this will make the part spin smoothly regardless of the server lagging

end)

Is RunService better than while loop?

Yeah because while loops ae not reliable, so is wait() but not wait(s).

1 Like