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

Checking Children count does not works?

Asked by 4 years ago
Edited 4 years ago

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
0
The problem is in the thing, that its says can't compare boolean to number, even though it if number GravityGouse99938 75 — 4y
0
where is the error? krowten024nabrU 463 — 4y
0
what line and what does it say in the line? krowten024nabrU 463 — 4y
0
line 1(here) it says attempt to comoare boolean and number, but print show number GravityGouse99938 75 — 4y
View all comments (2 more)
0
You've done a typo, You're meant to do :GetChildren not :GeChildren (Line 1) JeffTheEpicRobloxian 258 — 4y
0
I know it, but prbolem isn't in that GravityGouse99938 75 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

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!

0
thanks so much for help, it worked! GravityGouse99938 75 — 4y
Ad

Answer this question