I'm making a rocket, and I decided to make the rocket move forward using raycasting.
However, I ran into a slight problem as you can see in this GIF
This is the code that propels the rocket:
local RayN = Ray.new
local CF = CFrame.new
local HB = game:GetService("RunService").Heartbeat
delay(0, function()
for i = 1, 500 do
local Hit, Pos = workspace:FindPartOnRayWithIgnoreList(RayN(Rocket.CFrame.p, (Direction - Rocket.CFrame.p).unit), {IgnoreModel, Character, Tool})
if Hit then break end
Rocket.CFrame = CF(Pos)
HB:wait()
end
Rocket:Destroy()
end)
The problem isn't how fast I can shoot, I'm fixing that later. The problem is the direction the rocket is facing. How would I set the rocket to "look" in the direction of the mouse?
