Hello
I'm trying to find a way to make parts move smoothly across the screen. I began by using loops to reset the part position (through a vector3) : this worked ok but the movements were a little clunky.
So I tried attaching a bodyvelocity to the part and setting the values so it would move in the x axis. The script is below, and when I start the game the part does not move at all.
I'm assumign there is something really simple which I am missing here i.e another parameter needs setting. I'd be very grateful if someone could point me to what I am missing here.
workspace.Part.BodyVelocity.Velocity=Vector3.new(50,0,0) local p=Workspace.Part.BodyVelocity.Velocity print(p)
Thanks very much.
The thing is that it works, it is just not enough to actually show a difference, try putting it at 500 and you'll see the difference
I managed to get the effect I was after by using lerp. This was adapted from an earlier answer.
I'm stil scratching my head about velocity, but at least I have got the effect I was after :)
Thank you
local mover=game.Workspace.Mover -- the part you want to move local right=game.Workspace.RightBound -- a part which sets right bound for movement of mover
local start = mover.CFrame local finish = right.CFrame
-- over the course of ~1 second, vary progress
from 0
to 1
for progress = 0, 1, 0.03 do
-- consequently:
-- over the course of 1s, vary part.CFrame
from start
to finish
mover.CFrame = start:lerp(finish, progress)
wait(0.5)
end