This script basically checks to see if there are enough of a certain resource in a players pack and if there is it turns the text in a text-box green (so later another script knows there is enough). It works fine except I've noticed if I have more than 9 of an item in my player's pack, it doesn't recognize that i have enough. I'm wondering if It is because theres a problem with using double digits or something. Any ideas what it could be? (This is just the relevant part of the script so i don't show when i actually call the functions) Also I realize there's probably a better way to organize my variables but I'm relatively new to scripting so I do most things by "brute force" or any way I can get things done. So sorry about the mess :)
wait(3) local player = game.Players.LocalPlayer local BUTTON = script.Parent local FRAME = BUTTON.Parent.Parent.Parent:WaitForChild("WoodenWallpiece") local NBox1 = FRAME.ColumnFrame2.BoxFrame2 local NBox2 = FRAME.ColumnFrame2.BoxFrame3 local NBox3 = FRAME.ColumnFrame2.BoxFrame4 local NBox4 = FRAME.ColumnFrame2.BoxFrame5 local HBox1 = FRAME.ColumnFrame3.BoxFrame2 local HBox2 = FRAME.ColumnFrame3.BoxFrame3 local HBox3 = FRAME.ColumnFrame3.BoxFrame4 local HBox4 = FRAME.ColumnFrame3.BoxFrame5 local htext1 = HBox1.TextLabel local ntext1 = NBox1.TextLabel local htext2 = HBox2.TextLabel local ntext2 = NBox2.TextLabel local htext3 = HBox3.TextLabel local ntext3 = NBox3.TextLabel local htext4 = HBox4.TextLabel local ntext4 = NBox4.TextLabel FRAME.Visible = false function check_Have() local PACK = player:FindFirstChild("Pack") local name = FRAME.RowFrame2.TextLabel.Text local count = 0 for _, child in pairs(PACK:GetChildren()) do if child.Name == name then count = count + 1 else count = count + 0 end htext1.Text = count end if PACK:FindFirstChild(name) == nil then htext1.Text = "0" end print(count) end function check_enough() if htext1.Text >= ntext1.Text then htext1.TextColor3 = Color3.new(0,85,0) print("enough") else htext1.TextColor3 = Color3.new(255,0,0) print("not enough") end end