Attempt to compare string < number

Hi guys, I have been working on an update for my game and I came across an error. It will be highly appreciated if you can help me out! The error is at line 19

Code:

--Variables
local plr = script.Parent.Parent.Parent.Parent.Parent
local Stat = plr:WaitForChild("Stats") --Stats
local DS = plr:WaitForChild("DataS") --DataStore
local AF = plr:WaitForChild("Achievement") --Achievement Folder

--Values
local Points = DS.Points
local Stat = Stat.Multiplier
local Value = script.Parent.Value
local Value2 = DS.Price1
local AchievementBuff = AF.Buff

--Config

--Code
script.Parent.MouseButton1Click:Connect(function()
if Points.Value > Value2.Value then
Points.Value -= Value2.Value
Value2.Value = Value2.Value+(Value2.Value*0.05)
AchievementBuff.Value += 0.25
end
end)

Thanks for helping me out! I will give everyone a heart that replies to my topic!

The problem lies within Value2.Value. Try replacing it with tonumber(Value2.Value), if that doesn’t work it means it contains characters.

1 Like

it works! thanks a lot for helping me. You deserve a heart!

1 Like