(Probably very dumb but…)
Couldn’t you multiply X and when you get a number taht equals the number you are substracting from you’ll end everything, if it’s higher take multiply it by 1 number less, and if it’s lower multiply it by one number up?

Essentially, I have a number and I have to multiply it by X until the number is greater than what the player has, then I revert the multiplier by 1 to then get the maximum number I can remove it from with it still being a multiple of Y.

I’m going to try applying it tomorrow, its 3:11AM for me at the moment.
Will return with results.
(Also, when I will try implementing your solution into my code, what do I put as amount and base?)

Also, I have been trying to solve this myself for 2 hours…

And how will this help? In order to use multiplication in that manner for this case, you will need to get the reciprocal of the divisor, which still involves division. Also, the difference in performance disputed; it could be nanoseconds of difference which is practically meaningless and not worth it at all to make the change.

task.wait(4)
local s1 = os.clock()
for i = 1, 1e9 do
local v = i / 100
end
local e1 = os.clock()
task.wait(4)
local s2 = os.clock()
for i = 1, 1e9 do
local v = i * 0.01
end
local e2 = os.clock()
print("division", (e1 - s1), "ns per") -- division 5.019934599753469 ns per
print("multiplication", (e2 - s2), "ns per") -- multiplication 4.967759200371802 ns per

That’s a difference of 0.047 milliseconds, or 47 microseconds. Each run does the operation a million times (the loop is from 1 to 1E+6), so 47/1000000 = 0.000047 microseconds, or 47 picoseconds. So yes, it actually is nanoseconds of difference. This may matter to you, but I don’t think the OP intends on running his code millions of times.

Even if it is slightly faster, it wont really matter like you said.
He was asking for the fastest way, and Multiplication would slightly faster (Usually), but there are a few cases where Division is faster, so it isnt always perfect.