Hello! I'm trying to check for childrens inside of backpack, but it gives an error, but it normaly displays it from print
Here's the code:
if not #plr.PlayerGui.ScreenGui.OreInventory.Back.Scroll:GeChildren() >= 3 then --mine stuff else require(game.ReplicatedStorage.Modules.Alert).Push("Your backpakc if full! Go and sell it.", Color3.new(1, 0.870588, 0.12549), game.Players.LocalPlayer) debounce = true end
Well, the error is valid. You are trying to compare boolean
with number
.
Question:
Where does that boolean
value comes from?
Simple Answer :
In Line 1
, you are using if not
which return a boolean
value. You might have known that it is substitute of if something == false
. So, that what's the system is trying to say. Basically, you are comparing, true/false
by >= 3
or true/false
by number of contents.
What to do to fix your issue?
Well, you can replace your code with :
if #plr.PlayerGui.ScreenGui.OreInventory.Back.Scroll:GetChildren() < 3 then
It will execute only when the contents are less than 3.
Lemme know if it helps!