Why are launched objects shooting out from the side

I’m creating a Launcher that acts as a mortar as in it doesn’t have a repulsion system but the rockets keep firing out of the side and i don’t know how to fix it.

Code:

script.Parent.Activated:Connect(function()
	local Lemon = Instance.new("Part")
	Lemon.Position = script.Parent.PrimaryPart.Position
	Lemon.Parent = game.Workspace
	-- Lemon.CanCollide = false
	Lemon.Orientation = script.Parent.PrimaryPart.Orientation
	Lemon.Velocity = Vector3.new(script.Parent.PrimaryPart.CFrame.LookVector.X, 5, 
		script.Parent.PrimaryPart.CFrame.LookVector.Z)
end)

Check the orientation of the primary part. It’s probably just rotated 90 degrees. Rotating it should change the direction it shoots.

issue may be related to how you are setting the initial position and orientation of the rocket (Lemon). The Lemon.Position and Lemon.Orientation are being set directly without considering the rotation of the launcher. Additionally, the velocity might not be applied in the correct direction.

try this simplified code:

script.Parent.Activated:Connect(function()
    local Lemon = Instance.new("Part")
    
    -- here we set initial pos and orientation based on launcher's pos and rotation
    local launcherCFrame = script.Parent.PrimaryPart.CFrame
    Lemon.CFrame = launcherCFrame * CFrame.new(0, 0, -5) -- Adjust the offset based on your needs
    Lemon.Parent = game.Workspace

    -- velocity based on launcher's orientation
    local launchDirection = launcherCFrame.LookVector
    Lemon.Velocity = Vector3.new(launchDirection.X, 5, launchDirection.Z)
end)