Can yall please help me

Hi yall this is the link to my code(https://arcade.makecode.com/S24899-53111-65016-91949)

The problem I am running into is that when I say pick random between 0 and 4 it always picks 0 and I don’t know why. here’s a photo of the code, Any help would be useful, Thanks

3 Likes

You’re setting gambling to your random value, but you’re testing against Choice. Use your gambling variable in your if() statements.

3 Likes

Thanks for letting me know, but unfortunately I tried doing what you said and it gave me a null error. Do you know why that is, Thanks

LETS GO GAMBLING” -@Malnotle

But to put @AlexK’s words simpler your issue is that when asking gambling variable to pick a random 0-4, instead of asking gambling is = 0 if else gambling = 1 ect, you have a random variable “Choice“

Use the debugger to understand your code better and to get at the source of your new error.

More than likely, one of your ItemX() functions is trying to work with a sprite that has not yet been created.

Ok, Thanks so much