Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I tried to compare 2 values and it says that it tried to compare a string to a value?

Asked by 3 years ago

Here is the output: 12:41:21.126 - Players.tyorange09.PlayerGui.Withdraw.Bank.TextButton.LocalScript:7: attempt to compare string and number

Here is my code (Local Script): script.Parent.MouseButton1Click:Connect(function() local player = game.Players.LocalPlayer local CashAmount = script.Parent.Parent.TextButton.Text

if player.Pstats.Bank.Value > CashAmount then

    player.Pstats.Bank.Value = player.Pstats.BankCash.Value - CashAmount

    player.Pstats.Cash.Value = player.Pstats.Cash.Value + CashAmount

    script.Parent.Parent.Visible = false

end

if player.Pstats.BankCash.Value < CashAmount then

    script.Parent.Parent.TextBox.Text = "Incuficent Balance!"

    script.Parent.Parent.TextBox.BackgroundColor3 = "#ff0000"


end

end)

0
script.Parent.MouseButton1Click:Connect(function() local player = game.Players.LocalPlayer local CashAmount = script.Parent.Parent.TextButton.Text if player.Pstats.Bank.Value > CashAmount then player.Pstats.Bank.Value = player.Pstats.BankCash.Value - CashAmount player.Pstats.Cash.Value = player.Pstats.Cash.Value + CashAmount script.Parent.Parent.Visible = false end if player.Pstats tyorange09 4 — 3y
0
Bank.Value > tonumber(CashAmount) Ziffixture 6913 — 3y
0
ok thx tyorange09 4 — 3y

Answer this question