RayCast for Mobile Devices

I trying to make a mobile gun system, but the gun is not giving damage.

function Fire_Auto()
	while Mouse1Down == true and Reloading == false and Settings.CurrentAmmo > 0 and FireDebounce == false and Aiming == true do
		FireDebounce = true
		Fire_Anim:Play()
		Character.CameraSystemLocal.ChangeCamera:Fire("Fire", Settings.Recoil)
		Settings.CurrentAmmo = Settings.CurrentAmmo - 1
		local ray = Ray.new(script.Parent.Handle.Muzzle.WorldPosition, (Mouse.Hit.p - script.Parent.Handle.Muzzle.WorldPosition).unit * Settings.MaxBulletDistance)
		local part, position = workspace:FindPartOnRay(ray, Player.Character, false, true)
		Fire_RE:FireServer(position)
		local Beam = Instance.new("Part", workspace)
		Beam.FormFactor = "Custom"
		Beam.Transparency = 1
		Beam.Anchored = true
		Beam.Locked = true
		Beam.CanCollide = false
		Beam.Name = "Bullet"

		local Distance = (script.Parent.Handle.Muzzle.WorldPosition - position).magnitude
		Beam.Size = Vector3.new(0.05, 0.05, Distance)
		Beam.CFrame = CFrame.new(script.Parent.Handle.Muzzle.WorldPosition, position) * CFrame.new(0, 0, -Distance / 2)

		game:GetService("Debris"):AddItem(Beam, 0.05)
		if part then
			local DetectedHumanoid = part.Parent:FindFirstChild("Humanoid")
			if not DetectedHumanoid then
				DetectedHumanoid = part.Parent.Parent:FindFirstChild("Humanoid")
			end
			if DetectedHumanoid then
				InflictTarget_BE:FireServer(DetectedHumanoid, part, position)
			elseif not DetectedHumanoid then

			end
		end
		wait(Settings.FireRate)
		FireDebounce = false
	end
end

This is my Ray line:

local ray = Ray.new(script.Parent.Handle.Muzzle.WorldPosition, (Mouse.Hit.p - script.Parent.Handle.Muzzle.WorldPosition).unit * Settings.MaxBulletDistance)

Take a look at this post here, it should help