#how to make currency value not go below zero

1 messages · Page 1 of 1 (latest)

magic jackal
#

hii, i recently made a currency for a game that im working on, and i noticed that players can buy as much items as they would want without them actually needing the money required to get them (in simple terms, players are able to spend money when they dont HAVE money). any help fixing this bug is appreciated!

rugged plaza
#

wheres the buying script

magic jackal
#

oh yeah hold on

#

@rugged plaza

rugged plaza
#

just check if the money value is greater or equal to 7

magic jackal
#

uh

#

how

light hinge
#

...

#
if player.moola.Value > (cost - 1) then
  player.moola.Value -= 7
end
#

its that simple

magic jackal
#

ooh okay!!

#

thanks

light hinge
#

np

#

i just dont get it

#

how did u make a leaderstats script from scratch

#

and not have basic knowledge of ifs

magic jackal
#

oh i didnt make it off of scratch i kinda just

#

followed a youtube video lol

#

i usually just try to understand how they use certain statements and classes and try to freehand some code but it always ends up with me asking for help in here

light hinge
#

oh ok

warm sluiceBOT
#

studio** You are now Level 3! **studio

magic jackal
#

is that supposed to happen?

#

ok nvm i got it working myself (yay!!)

unique latch
# magic jackal ooh okay!!

i recommend you learn the fundamentals first

IF statements
LOOPS
Variables

there are some good series where they work you up until you can stand on your own feet

magic jackal
unique latch
#

Good luck on your journey
Do little projects to keep yourself learning