#why am I getting an error trying to subtract 2 numbers?
1 messages · Page 1 of 1 (latest)
coins is a string of 100 so how i make it into a number of 100?
this works and im basically doing the exact same thing
tonumber()
already tried that still got error
im not
oh ok
where is coinsvalue defined
the textlable is equaling coinsvalue so the coins can be displayed on the gui but im getting this error that once i get resolved will prob fix the problem im having
you send 2 parameters on the event fire
And the event function receives 1
Which would be the string
Bcuz its the first parameter
no im sending 1 parameter and its either "checkcoins" or a number value not both at the same time
and when i print the coins value in the else part its 100
the only solution here is tonumber
Why don't you try printing the values outside the if statement
or change how the system works
its in the 2nd ss i snet above
no show where u declared it
it didnt change
Show the prints
if ur asking where "local coinsvalue = number" it does not exist cuz it gets in the way
I dont get the prints
Put the prints above the if statement
And make them clearer like
"START"
"CONDITION1"
mk
"CONDITION2"
Its not erroring though
Try tonumber() on both coinsvalue and coins
already tried that and u cant
Holon coinsvalue = tonumber(coinsvalue) - tonumber(coins)
So that means they're both strings
Or
1 of them is a string that csnt be turned into number
but its sayd number and string
Number and nil
So if that vwhen you turn it into number and it's nil
That means it cant be turned to number
woulddnt it print "nil"?
It did
u right
i have before and it got in the way but ill do it again
Ok could you just send the whole script , this whole thing kinda confusing
its a lot
do u want both scripts where it fires the bindable event (im 99.999% sure the problem aint there)
Mmm
Sure
u can prob ignore the last 2 (this is the first script)
this is prob all u need from the second script
ive got sum stuff to change at the top of the first script and the stuff for portals but im doing this first cuz its not working and I dont know why but ik why that wont work up there
Try
coins = tonumber(coins)
coinsvalue = tonumber(coinsvalue)
Then u subtract
coinsvalue -= coins