So the only reason why im posting this is because if i put the price to 2 it's gonna work but if i put it to like 2000 it's gonna send this error. Here is the script :

RKatana = 2000

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    if player:FindFirstChild("leaderstats") then
        -- We know that the player has leaderstats
        if tonumber(player.leaderstats.Cash.Value) >= RKatana then
            player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - RKatana  
            local copy = game.ServerStorage.RKatana:Clone()
            copy.Parent = game.Players.LocalPlayer.Backpack

        end
      end   
    end)

3 comments

0

Huh.. is the value from the Cash a number or string?

0

But, if the Cash's Value is a number, then you don't "tonumber". Because, if its a number then you cant get a number out of a number. So, thats why it's nil

0

Yea but the problem is that if i don't do the tonumber its gonna say attempt to compare number with string thats why