No that shouldn’t of changed anything “+=” is the same as what you just done.
Lol, your very welcome! Have a great day/night!
Yeah, I agree with @DevFoyRBX. That shouldn’t change anything in the script, they do the same thing, and that “+=” is after the <= operator (which is where the ‘Attempt to compare string “<=”’ comes from). You must’ve done something else to fix it
What he did would error, since the computer is confused. Basically, what he did was say the players leaderstats was plus 1 and equal one, which would result in a syntax error.
He is forgetting something he fixed the code before even looking at yours. His error is 3 lines before that egg code. it shouldn’t of even counted that code. He must find out what he did to fix
if plr.leaderstats[currency].Value >= price then
because that caused the error as you can see in the error he fixed that then gave the wrong solution.
And I mean hey, if it worked than it worked.
Yes, but he was using a leaderstats which is totally different than just 2 number variables.
I’m not here to argue, but it’s fixed now, so lets move onto a different post.
No, it still works…
I want to actually find the problem so that if the OP finds the problem again, they’ll know what the problem is instead of changing something unrelated to it.
@Inconcludable This explains he gave a false solution.
The issue with the script is that the “price” variable is a string, so assuming it’s just a number, you could do tonumber() on it, which would work as long as the string is just numbers. Otherwise, I’d save the price as a number elsewhere. Changing x += 1 to x = x + 1 has nothing to do with it since they do the exact same thing (and it comes after the error).
He had the string issue because he diddn’t do “currency.Value” and “cost.Value” . He must of fixed it and gave the wrong solution cause doing .Value in a var sometimes doesn’t work well for me it never works but some people get lucky with it.
Can you provide the full script? Both of those lines do the same thing so that shouldn’t have fixed anything.
This topic got solved, but they’re arguing over it because apparently they think my solution did nothing. (The other people, not spidey.)
Wouldn’t this be correct btw??
Arithmetic operations can work on strings but comparison operations do not, the original poster seems to be attempting to compare and perform arithmetic on a non-number value.
local num = "1" num+=1 print(num) --2 is output
So it’s just safer to use
Player.leaderstats.Value = Player.leaderstats.Value + 1, because that’s what I was taught.
It really makes no difference. It’s just syntactic sugar.