Hello! I am trying to script a rocket launcher. With my rocket launcher, i want the rockets to always point towards it's own velocity when fired, just like how an arrow would fly through the air. I can't seem to find out how to do that though. This is my script:
while wait() do rocket.CFrame = CFrame.Angles(rocket.Velocity) end
This doesn't work, it just throws me an error.
Full script:
tool = script.Parent Handle = tool.Handle launcher = tool.Launcher tool.Equipped:connect(function(mouse) mouse.Button1Down:connect(function() local rocket = game.ServerStorage.Rocket:Clone() rocket.Parent = workspace rocket.CFrame = CFrame.new(launcher.CFrame.p, mouse.Hit.p) rocket.Velocity = rocket.CFrame.lookVector * 100 while wait() do rocket.CFrame = CFrame.Angles(rocket.Velocity) end end) end)
rocket.Orientation = CFrame.new(rocket.Velocity).lookVector