Here's an approach using a matrix, for which you'll have to decide the maximum number of flips beforehand. It checks if each run ever goes above the amount within the maximum number of flips (not the probability of ending up with the amount). Packaged up in a function so we can rerun it easily,
flip_coins <- function(n_runs, n_flips, amount, prob = 0.5, seed = 47, plot = TRUE){
set.seed(seed) # so sampling is reproducible
# make an n_runs x n_flips matrix of 0s and 1s
flips <- matrix(rbinom(n_flips * n_runs, 1, prob), nrow = n_flips)
# replace 0s with -1s so flips is now the amount won/lost for each flip
flips[flips == 0] <- -1L
# take a cumulative sum of each column to track total made/lost
winnings <- apply(flips, 2, cumsum)
if (plot){
# plot cumulative winnings, with opacity
matplot(winnings, type = 'l', col = "#00000022", lty = 1, xlab = "flip")
abline(h = 0) # break-even line
abline(h = amount, col = "red") # amount tested line
}
# check if winnings ever go above amount and divide by n_runs to get probability
sum(colSums(winnings >= amount) > 0) / n_runs
}
flip_coins(n_flips = 100, n_runs = 10, amount = 5)

#> [1] 0.7
flip_coins(100, 100, 5)

#> [1] 0.57
flip_coins(100, 1000, 25)

#> [1] 0.36
Messing with the probability of getting heads even a little (3%) can impact the result enormously:
flip_coins(100, 1000, 25, prob = 0.53)

#> [1] 0.95