How to fix this ability

I’m trying to make this ability but I’ve ran into some problem. The problems are below, I basically don’t know what to do to solve these problem.

This is what’s meant to happen
robloxapp-20210605-1148141_Trim.wmv (275.6 KB)

This what’s happen when the player aim at the sky
robloxapp-20210605-1148316_Trim.wmv (775.6 KB)

This is what happen when u aim at a wall or something
robloxapp-20210605-1148561_Trim.wmv (502.2 KB)

The script\

script.Parent.Effect.OnServerEvent:Connect(function(player,Vector,NotAimed)

	player.Character.PrimaryPart.CFrame = CFrame.new(player.Character.PrimaryPart.Position,Vector3.new(Vector.X,player.Character.PrimaryPart.Position.Y,Vector.Z))
	
	local Animation1 = script.Parent.Mid
	local Animation2 = script.Parent.Land
	
	local MidAnimation = player.Character.Humanoid:loadAnimation(Animation1)
	local EndAnimation = player.Character.Humanoid:loadAnimation(Animation2)
    	
    player.Character.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame + Vector3.new(0,30,0)
	
	MidAnimation:Play()
	
	local BodyPosition 
	
	if NotAimed == false then
	    BodyPosition = Instance.new("BodyPosition")
	    BodyPosition.P = 35000
	    BodyPosition.MaxForce = Vector3.new(20000,20000,20000)
	    BodyPosition.Position = Vector
	    BodyPosition.Parent = player.Character.HumanoidRootPart
	else
		BodyPosition = Instance.new("BodyPosition")
		BodyPosition.P = 35000
		BodyPosition.MaxForce = Vector3.new(20000,20000,20000)
		BodyPosition.Position = player.Character.HumanoidRootPart.Position + player.Character.HumanoidRootPart.CFrame.lookVector * 30 
		BodyPosition.Parent = player.Character.HumanoidRootPart
	end
	
	wait(0.3)
	
	local Effect = game.ReplicatedStorage.Affect.Mark.AerialAceEffect:Clone()
	
	local Landed = false

	while true do
		if Landed then	
			TouchFunction:Disconnect()
			TouchFunction2:Disconnect()
			TouchFunction3:Disconnect()
			TouchFunction4:Disconnect()
			break
		end
		wait(0.1)
	end

	Effect.Effect.Value = player.Name
	
	MidAnimation:Stop()
	EndAnimation:Play()
	BodyPosition:Destroy()
	
	Effect.Sound:Play()
	
	wait(0.3)
	
	Effect.Name = "AerialAceEffect"
	Effect.Parent = workspace	
	Effect.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame
	Effect.HumanoidRootPart.Anchored = true
	
	local TweenInformation = TweenInfo.new(
		0.8, 
		Enum.EasingStyle.Linear,
		Enum.EasingDirection.In,
		1,
		false
	)

	local PartProperties = 
	{
	 Transparency = 0.6
    }
	
	for i, v in pairs(Effect.Effects:GetChildren()) do
		local Tween = TweenService:Create(v,TweenInformation,PartProperties)
		Tween:Play()
	end
	
	wait(0.8)
	EndAnimation:Stop()
	Effect:Destroy()
	player.Character.Humanoid:EquipTool(player.Backpack:FindFirstChildOfClass("Tool"))
	script.Parent.CanAttack.Value = false
	RealTouchFunction:Disconnect()
end)

local script

    local Distance = (player.Character.HumanoidRootPart.Position - mouse.hit.Position).magnitude
			if Distance < 150 then
				script.Parent.Effect:FireServer(mouse.hit.Position,false)
> 			else
> 				script.Parent.Effect:FireServer(mouse.hit.Position,true)
> 			end
> 		end
> 	end

Hi, the videos are downloadable but I don’t know how to make it so it display on the topic, if someone can tell me how to, it would be very appreciated, thanks.