How to make CFrame go in orientation of part

Hello!
I’ve been working on my game, and I have came across a problem…
Im making a rocket that shoots, but, uh…

I dont know how to make it move forward in its orientation.
My script is very simple.

local part = script.Parent
while true do
	wait()
	part.CFrame = CFrame.new(part.Position) * CFrame.new(0,0,0.7)
end

My problem is that when the part is for say, angling down, it will just… well, move forward in the axis direction

Any help is appreciated.

Firstly, don’t use the while-do loop, it’s preferable to use RunService. Mmmm I don’t understand your problem, but I think you need use the next:

part.CFrame *= CFrame.new(0,0,0.7)

It works?

That isnt the problem. I need it to go forward in the orientation its facing.

It always is in the rocket orientation?

Huh? No. I want the part to always go forward no matter the orientation. Like for example it goes in the Z direction. Now, if I made the part face up, I would want it to go in the Y direction

use a body velocity

local speed = 100
local bv = Instance.new(“BodyVelocity”)
bv.P = 1000
bv.MaxForce = Vector3.new(100000,1000000,100000)
bv.Parent = script.Parent

while task.wait(0.1) do

bv.Velocity = script.Parent.CFrame.LookVector*speed
end

put this in the rocket (ammo/bullet thing) in a server script
mighta made a few typos since I’m on a phone

2 Likes

It works, but it becomes misplaced when stepped on. I’ll just make CanCollide false.

1 Like

Oh yeah, physics does that. Doesn’t it explode on impact though?

Yeah, heh, it does. Thanks for the script.

1 Like

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