How can I make a Part move diagonally from its current position?

Hi, I’m trying to make the ball on the top right move to the position of the ball in the bottom left, (assuming its not there). If you have played A Universal Time, you would know the Goku Spirit Bomb move, and I want to kind of recreate it.

Any help is appreciated.

Using CFrame.LookVector you can move it in the direction it is facing, and then you just add an offset on the Y axis to make it move up as well.

local forwardComponent = part.CFrame.LookVector * 10
local upComponent = Vector3.new(0,10,0)
--Moves 10 stund in the facing direction and 10 studs up
local CF = part.CFrame + forwardComponent + upComponent

--Interpolate to the new CFrame (you can use tweening if you want)
for i = 1, 100, 1 do
	local t = i/100
	part.CFrame = part.CFrame:Lerp(CF, t)
	task.wait()
end

works perfect, but how do i know when its stopped so i can run another function?

Simply wait until the loop has finished. The script won’t continue until for loop is done.
If you’re tweening then wait for as long as your tween takes (you choose how long the tween will be when creating it).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.