Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Checking Children count does not works?

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

6 comments

0

The problem is in the thing, that its says can't compare boolean to number, even though it if number

0

where is the error?

0

what line and what does it say in the line?

0

line 1(here) it says attempt to comoare boolean and number, but print show number

0

You've done a typo, You're meant to do :GetChildren not :GeChildren (Line 1)

0

I know it, but prbolem isn't in that

1 answer

✓ Accepted answer

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!

1 comment

0

thanks so much for help, it worked!

This discussion is preserved as it was. New answers, comments, and votes are closed.