Error nil comparing with number

I used this code to compare numbers on a textButton with a number
but I got this error and I don’t understand why…

image

, thanks

1 Like

because you are comparing a number, to a value that is nil, show that line of code please

1 Like

Can you show me the script please?

1 Like

oh okayy sorry for late reply here

Your text seems to be nil, or it is just a string. Can you define what exactly is written in the textlabel. Alternatively, if you are creating a number for the textlabels text you can just compare the actual number instead of using the text of the text label.

oh on the textButton it’s number.
I convert number to string first and then do textButton.Text = tostring(the number)
EDIT: I didn’t store it in an intvalue or anything like that

Im confused… why arent you just comparing the number then? Also you do not have to use tostring for a number on a textlabel. Could you show me a explorer photo of the text label and tell me what exactly is the number?

oh okay here

this one
image

I will afk a few minutes.ฺฺฺฺฺฺฺฺฺฺฺ

Sorry for the late reply, was off a bit. Where do you change the number of the textlabel? Also with explorer i didnt mean the gameplay, i just wanted to know where you are defining the number as an instance.

oh sorry for late reply
image

I might be reading this tommorow

You should, cause it looks like you buy something with the button, the server should record what price it is in a NumberValue or IntValue, and when the client detects a click, send a RemoteEvent to the server with the type of upgrade, the server from there can validate the purchase and go through with it.