local function l(l,i)local x=game.Players.LocalPlayer.Character local L=Handle.Position+Handle.CFrame.lookVector*(Handle.Size.Z/2)local D=l:FindFirstChild("\066\111\100\121\086\101\108\111\099\105\116\121")local V=l:FindFirstChild("\066\111\100\121\071\121\114\111")local Y=l:FindFirstChild("\069\120\112\108\111\100\101")l.Velocity=Vector3.new(0,0,0)l.CFrame=CFrame.new(L,i)if D and V then local l=(i-L).unit D.Velocity=l*ROCKET_LAUNCH_SPEED V.CFrame=CFrame.new(Vector3.new(0,0,0),l)end if Y then l.Touched:Connect(function(i)if not IGNORE_LIST[string.lower(i.Name)]and not i:IsDescendantOf(x)then Y:FireServer(l.Position)end end)end end

local function LaunchRocket(Rocket,TargetPos)
	local Character = game.Players.LocalPlayer.Character
	local SpawnPosition = Handle.Position + (Handle.CFrame.lookVector * (Handle.Size.Z/2))
	local BodyVelocity = Rocket:FindFirstChild("BodyVelocity")
	local BodyGyro = Rocket:FindFirstChild("BodyGyro")
	local ExplodeEvent = Rocket:FindFirstChild("Explode")
	Rocket.Velocity = Vector3.new(0,0,0)
	Rocket.CFrame = CFrame.new(SpawnPosition,TargetPos)
	
	--Set the velocity and direction.
	if BodyVelocity and BodyGyro then
		local Direction = (TargetPos - SpawnPosition).unit
		BodyVelocity.Velocity = Direction * ROCKET_LAUNCH_SPEED
		BodyGyro.CFrame = CFrame.new(Vector3.new(0,0,0),Direction)
	end
	
	--Fire the event when touched.
	if ExplodeEvent then
		Rocket.Touched:Connect(function(TouchPart)
			if not IGNORE_LIST[string.lower(TouchPart.Name)] and not TouchPart:IsDescendantOf(Character) then
				ExplodeEvent:FireServer(Rocket.Position)
			end
		end)
	end
end


