How would I make it so player can't donate starter cash?

Hello!

I am trying to create a Roleplaying Game and the player starts out with $5000 in their bank.

There will be a functionality where they can donate and drop cash. How would I make sure that they can’t donate the 5000$ starter cash or drop it.

I have no clue on how to implement this so It would be awesome if you all could help me.

Thanks in advance!

1 Like

There are a few ways to go about it.

One method is by checking the player’s cash amount. I assume, you using DataStores. I’m not sure how your DataStores are wired, but I assume your using an else statement and giving the StarterCash if they don’t have previous data. In this scenario, you can disable the donate cash (however you implemented the functionality). Though, I guess a better way is by checking the amount of cash when they’re donating, or even prior that, as well as if they’re a new player or not (Assign Variable, else statement, something to recognise new player?). You can check if the player’s amount of cash is equal to 5000, disable the functionality and once their cash is over 5000, allow for them to donate. You should consider setting limits to how much they can donate once they have passed the conditional statement.

Another method is by using BoolValues. If the BoolValue’s value property is true, then they have the Starter Cash, and therefore shouldn’t be allowed to donate.

In summary, assign a variable, condition, value, etc that can be used to state they have the StarterCash. Check if condition, value, satisfies. If it does, disable the functionality. Enable the functionality when their StarterCash is >5000. From here, you can either allow them to donate any amount or you could set limits as to how much they can donate.

E.g Xx_FrostBitexX’s cash = $5500, StarterCash = $5000
5500 - 5000 = 500. They can only donate $500. They can’t donate the StarterCash.

2 Likes

Try doing something like this:

starterCashAmount = 5000
starterCash = true

function drop(amount)
   if amount > starterCashAmount and starterCash = true then
      newAmount = amount - starterCashAmount
      starterCash = false
   end
end

Note: I only made this script to get the idea of it.

1 Like