Minecraft – How to make the Scoreboard not fall below 0? MCPE 1.6

minecraft-bedrock-editionminecraft-commands

The scoreboard I've made is called credits. I want people to have fun and buy items with it, but I've discovered that I can go below 0 with my credits, and that breaks everything because the other commands now interpret me as having unlimited credits now.

How do I make it not go below 0 using commands?

Best Answer

Place a repeating command block on the ground and set it to Always Active.

Place this command into it:

scoreboard players set @a[scores={credits=..0}] 0

This command will target everybody whose score is less than 0 and set their score to 0.