How to make a % increase for currency gamepass

How can I make a gamepass that gives you for example 15% extra coins or something

Here is a basic pseudocode example of how that could be done:

local MS = game:GetService("MarketplaceService")
local gamepassId = 1818 --change this

local function AwardCoins(player, amount)
    local hasPass = MS:UserOwnsGamePassAsync(player.UserId, gamepassId)
    if hasPass then
        player.leaderstats.Coins.Value += amount * 1.15
    else
        player.leaderstats.Coins.Value += amount
    end
end

--when someone should get coins...
AwardCoins(game.Players.jmt99, 250)

I have a similar way of doing this but dont know if its correct, for example 20%

5 coins * 0.20 (because its 20% so its 0.20)

That would calculate 20% of 5, which would be 1. You can add that value back to the 5 to get the 20% more 5 + (5 * 0.2) or you can simply just multiply 5 by 1.2 which gives the same result in less steps.

This won’t work, because it will only make it 20% of 5, so you should do 120% of 5 in order to get more coins

1 Like

So I have to do 1.20% for it to work

Whenever you want to increase a number by a percentage, you should always multiply it by 1+percentage instead. So, if you wanted 50% more coins, you would multiply by 1 + 0.5 (1.5), and not just 0.5 which would give you 50% less coins.

I would generally just get the percentage of the amount giving so (example: 20, find 15 percent of 20 = 3 => then add 20 + 3 = 23 coins earned)

so ur saying if i want 30%

i do 5 coins * 1.30 or 5 coins + (5 * 1.30)

Find 30% of 5 = 1.5 => 5 + 1.5 = 6.5

please explain this more indeph because i dont under why there is 1.5 & 5, is 5 the original amount of coins

That is the long way to do it. Writing 20*1.15 is the more proper way to increase something by a percentage and gives the same result as 20+(20*1.15) but in less code and math operations.

That is correct. They will accomplish the same thing, but are just different ways to write it and calculate it.

Edit: actually your 2nd part is slightly wrong, it should be 5 + (5*0.3)

can you explain why i cannot use just 5 * 0.30? that i have to use 5 * 1.30

So you can either do my way of Jmt, basically I calculate 30% of 5 so 30% of 5 = 1.5 because 10% of 5 = 0.5 * 3 (to get 30%) = 1.5

because 5 * 0.3 will mean a decrease meanwhile 1.3 will keep the value at the constant of 5 while applying the 0.3 increase

1 Like

Say for example the base value for coins you are awarding is 20 and the bonus is 30%. If you do playerCoins = playerCoins + 20*0.3 you will end up giving the player 6 coins only, which is 70% less coins, not 30% more. This is why instead you will do 20*1.3

1 Like

I agree with @jmt99 it makes more sense and if you do it on a calculator so his method is correct.