Hi, I’m doing scripts to move BaseParts, but I would like to know which is the softest way or the way to see a detailed animation for the movement of them ?, I used TweenService but I would like to know if there is another way to do it, more efficient … Thank you.
Probably TweenService, you can move parts using it by setting TweenInfo(duration, EasingStyle and Direction) and goal(goal properties of the part, in this case Position or Cframe)
I feel like tween service is most efficient tbh, but another method would just be adding a Vector3 to the parts CFrame in a for i loop. For example:
for i = 1,10 do
part.CFrame = CFrame.new(part.Position + Vector3.new(0,0,0.1)
wait(0.1)
end
With this it’ll move the part 1 stud, [10 x 0.1 = 1]
Mess around with the loop and the stud movement if you want. This is the only other way I can think of that works.
if you mean the way that’ll most likely get you the least lag while keeping your tweens slick, i found this neat little module someone made that basically handles tweens on the client but still changing the part (at a lesser cost) via serverside.
You can also use Lerp;
local part = Workspace.Part
local startCFrame = part.CFrame
local endCFrame = CFrame.new(10,2,5) * CFrame.Angles(0.2,0.5,0.1)
for i = 0,1, 1/30 do
part.CFrame = startCFrame:Lerp(endCFrame, i)
wait()
end
--This also works with Vector3s
Keep in mind changing the CFrame of the part is essentially teleporting it, while using i.e. BodyMovers makes the physics engine actually move the part, which is usually better.
Here are some tips:
- if your part is unanchored, try using BodyMovers or such
- if your part is anchored, you can make every client move the part on their own screen, to make it look more smooth and avoid the replication delay (as long as it doesn’t break your game)
Yeah these are mostly all the ways you can do it, but sadly there is always just that feeling that all these are unnefficient and not cool, like lerp uses a lot of for loops, if you wanna tween you need a billion variables, and bodymovers are just not super precise. But this is if you’re gonna do something big, but if it’s something simple that is involving just 1 mouvment maybe, you can pull it off.
It might be dumb to ask but, roblox should add a better of smoothly moving parts.
Tween service is as smooth and precise as possible. I don’t see any problems with it
Body movers are legacy, consider using constraionts such as AlignPosition, LineForce or VectorForce instead. There’s equivalent functionality for all except BodyVelocity.
right after posting this post, I thought about that … I would have to prove that anyway it’s the best option (I think)
yeah they are totally fine, but if you’re doing a lot of moving parts with them in a single script, you’re gonna end up having a lot of tweens if you’re having a lot of parts.
I think the best way to preform this, and the best way to move parts, is to use tweens, but efficiently.
Like this
local tweenService = game:GetService("TweenService")
function Tween(bla bla paramaters here)
local tween = tweenService:Create(bla bla paramaters)
tween:Play()
end
And yeah now instead of having a lot of variables this should keep things simple by making the tween within this function.
that’s what I used but I saw that when it came to moving I did not have such a smooth movement and I wanted to know if something softer than that could be done … I’ll be testing Steady TweenService V2
Yeah TweenServiceV2 is of course better
Roblox Tween Service is the easiest and smoothest way of moving an object.