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 4 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

01if player.Pstats.Bank.Value > CashAmount then
02 
03    player.Pstats.Bank.Value = player.Pstats.BankCash.Value - CashAmount
04 
05    player.Pstats.Cash.Value = player.Pstats.Cash.Value + CashAmount
06 
07    script.Parent.Parent.Visible = false
08 
09end
10 
11if player.Pstats.BankCash.Value < CashAmount then
12 
13    script.Parent.Parent.TextBox.Text = "Incuficent Balance!"
14 
15    script.Parent.Parent.TextBox.BackgroundColor3 = "#ff0000"
16 
17 
18end

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 — 4y
0
Bank.Value > tonumber(CashAmount) Ziffixture 6913 — 4y
0
ok thx tyorange09 4 — 4y

Answer this question