Multiplying Points Issue

Hello Roblox Developers,

I have been using @polarisprog Multiplier tutorial on how to make a pet hatching system. I have been watching and comprehending throughout his tutorials as I am a beginner at coding. However, I have come across a mini bug that I am struggling to solve:

Multiply Points Script:

I tried writing: player.leaderstats[currency].Value += amount * player.Multiplier.Value thinking that this would multiplier the players Points.

If you guys could please help me on this that would be great :slight_smile:

2 Likes

Add a seperate newline which uses *= and the multiplier instead of together with the +=:

local a = 5
local multiplier = 2

-- what you are doing --
local value = 15
value += a * multiplier -- value becomes 25
--  compared to  --
local value = 15
value += a -- value becomes 20
value *= multiplier -- value becomes 40
1 Like

So sorry to bother you. Not very good at coding but I’m giving it a try.

Would this be what your explaining about:

1 Like

I’m not sure I think you sent the same image

Ah yes, oops…

I wrote:

player.leaderstats[currency].Value += amount * multiplier would this be alright not sure what to change it to :frowning:

Please read my post, it shows what the value becomes when you do it through different methods, then apply the one that fits your needs

Thanks for helping me out with that. It worked :slight_smile:
However, I have found a slight issue that when the player Unequips the Tool it doesn’t give the player Points?

Is there any tips you can suggest for me?

I have added prints to help. However, its only printing “Normal Currency Amount” instead of “Multiplier Amount” When the player Unequips a pet it stops giving the player points which is strange …

image

try putting the tool.Equipped part in the elseif and the multiplier part in the if. the script will not do the elseif part if the condition in the if part is met so that might be the issue

Its a pleasure that I could get all your tips but this is not working I might just restart the tutorial I have been trying to learn from. Soon as though I might learn something else from it

player.leaderstats.currency.Value += (amount * player.Multiplier.Value)

Change your references to currency as in the above, also you should use brackets to perform arithmetic operations on particular values first.

1 Like

Does it not multiply the amount correctly or does it give you a point amount that is bigger than the player’s storage value?

Hi,

When the player unequips the pet its just gives them no points at all when clicked.

Make sure that when the player unequips the pets the multiplier value resets to 1 not 0.