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

can I rotate a part in increments using lookvector?

i've have a part that rotates to mouse.hit, using lookvector...

part.CFrame = CFrame.new(part.CFrame.p,mouseposition) 

however this rotates the the part instantly, is it posible to move in increment instead? could i change rotation to an angle and use a for loop maybe..

3 comments

0

Use a for loop that increments using three numbers, with the third number being how much you increment, as represented by a number.

0

Use the tweenservice

0

use tweening

1 answer

✓ Accepted answer

use game:GetService("TweenService"). It increases pretty much every number value in incraments throughout a given time, until it reaches the goal value. Here's an example with your script:

local tweenservice = game:GetService("TweenService")

loal tween = tweenservice:Create(part, TweenInfo.new(1), {["CFrame"] = CFrame.new(part.CFrame.p,mouseposition)}
tween:Play()

TweenService is kinda complicated, so I think you should read more about it at the links below:

TweenService

TweenInfo

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