Can't compare number to userdata? [SOLVED]
Asked by
6 years ago Edited 6 years ago
So I was trying to make a button green if the player has enough money and gray, if the player doesn't have enough money. The problem is, I can't compare his money value and the price of the item. The code looks like this:
02 | game.Players.PlayerAdded:connect( function (plr) |
03 | local money = plr:WaitForChild( "leaderstats" ).Money.Value |
04 | local bicyclePrice 1 T = math.random( 2 , 20 ) * 5 |
05 | bicyclesImage.MouseButton 1 Down:connect( function () |
06 | if money > = bicyclePrice 1 T then |
07 | bBuyButton 1 A.BackgroundColor 3 = BrickColor.Green().Color |
09 | bBuyButton 1 A.BackgroundColor 3 = BrickColor.Gray().Color |
And it shows me this error:
10:33:09.862 - ServerScriptService.InternetScript:491: attempt to compare number with userdata
Thanks for reading