Categories > Coding > Lua >

Whats the problem with my code?

Posts: 45

Threads: 18

Joined: Aug, 2022

Reputation: 2

Posted

My code keeps returning this error and i dont know whats wrong. The error is "attempt to compare string <= number"  and my code will be below. 

if not player.OwnedCharacters:FindFirstChild(character) and player.leaderstats.Cash.Value >= charRequested.Price.Value then
  • 0

Posts: 2014

Threads: 198

Joined: Apr, 2021

Reputation: 16

Replied

As the error says, string cannot be compared with a number. You will have to turn the string into an int, and it should work.

  • 0

Random quote here...

Posts: 45

Threads: 18

Joined: Aug, 2022

Reputation: 2

Replied

@VoidableMethod
Thanks! Got it working now

  • 0

Posts: 2014

Threads: 198

Joined: Apr, 2021

Reputation: 16

Replied

@tonful_joy No problem, glad I could help

  • 0

Random quote here...

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )