A child of a folder when GetChildren() is being printed "Folder has no children"

  1. What do you want to achieve? Keep it simple and clear!
    A children of a folder is not being registered even though it is a child of the folder

  2. What is the issue? Include screenshots / videos if possible!
    folder children not being registered - Album on Imgur

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Here is my 3 hour long chat with ChatGPT, which is going around in circles
    long hours with ChatGPT - Album on Imgur
    A basic run down would be:
    Look for the folder
    Look for it’s children
    “it has no children”
    change the script
    Look for the folder

    yeah you get it, I think

I don’t know if this is “asking for a script”. But I mean, a child isn’t a child of the folder? what?

1 Like

It is hard for me to see intuitively what’s happening without seeing the actual code here. The videos don’t help much but put unneeded time to check them.

However, I am guessing that there are two case scenarios that can result in this:

  1. The child instance was not added in time and was found empty before the addition.
  2. The client-server context boundary, it is completely invisible to the server since it isn’t handled and/or operated by the server. Everything that is executed in client contexts are not visible to the server.

Sure, I’ll show you the codes and explain. Hope it helps.

But first, these folders are added to the player when they join a game, just to make things clear.
image
And the GUI looks like this

(I’m using screenshots because I realized the forums was doing weird things to my code by splitting stuff ‘wrongly’)

First Script(ItemInventoryCheck), ServerScriptService
What this does is look through every child from a folder(ItemInventory), and update values depending on the information inside said child.
If a folder’s(child’s) “itemName…Number” value is 0, the folder gets deleted, pretty straight foward.


image

Second Script(EquipItem), Gui’s LocalScript
The script waits for the player to press the equip button, which creates a new int value. The name is the item and the value is the backpack hotkey(which I can’t work on rn cuz of this weird bug) and parents it to the “EquippedBackpack”. So, the child should already be inside the folder and actually be a child of the folder. Unlike the issue I’m having…



image

Third Script(AssignTools), ServerScriptService
It waits until a child(folder) of ItemInventory(or any other inventory folder) is removed, then calls a function which checks to see if any of the existing int values’ names inside “EquippedBackpack” have a correspoding folder in any of the inventories with the same name. If there is no folder with the same name, it destroys the int value.
Except, it hasn’t even got there yet, being stuck at the part where
image
and this pretty annoying as there are no errors, the int value is just there sitting in the folder, and it’s not finding anything.



Before

Destroying the items

After

Even though the script(s) know the folder is gone, therefore deleting the button, it can’t find the int value inside EquippedInventory, which is weird unless there’s something I don’t understand. Not even ChatGPT can solve this one, not with a 3 hour talk of going around in circles.
Another thing I tried was including the in deletion part inside the First Script and just destroy() everything relevant when itemNumber == 0, which was actullaly the original idea, but same thing happened.

I think I’ll go ahead and make some other visual things since I can’t really continue the codes with this block in the way.

change ipairs to inpairs in the line when it goes through every equippedInts.
ipairs only work if the table is an array.

I’m a bit confused, do you mean this
image
or this
image

I assume you meant the latter since the color is the same as “ipairs”
But I tested both and neither works.
Since there are no erros for either of them, and it just prints out “No children in EquippedBackpack”, I’m not sure what the problem is.
I also tried just telling it to look for stuff in the table(array?) directly like this
image
Same thing as before, no errors, no nothing.

yes keep it as in pairs that was a problem but not the only one.
from what I’ve seen i think it might be a replication issue between server and client…? the video is very blurry.

Can you send a screenshot of the entire explorer tab with every script of the inventory system visible and a screenshot of you going into server view and checking the item folder/integer at the point where the system gets stuck?

Screenshot 2024-03-23 053025 (how you go into server view)

I just noticed that you are creating the int value on the client but checking if it exists on the server. Client to server is not replicated unless it’s the character itself. Try setting up a remote function that fires when you create the numbervalue here:

and connect a server script to create the numbervalue whenever the remote is fired instead. This is bad practice since it’s exploitable but it’s the only fix without making major changes to how the system works.

–Scripts–


AssignTools, where the problem is
ConfirmationReceptionist, deletes the items when quest is done
InventoryTempCheckpoint, inspection to see if an item is allowed to be sent to the inventories
ItemInventoryCheck, handles the ItemInventory folder’s values and folder deletion when criteria met.

ForageTracker, not imprtant but that’s where some items go if the TempCheckpoint sends said items anywhere
(I forgot to mention this thing is cloned to the workspace)

InventoryListScript, for every folder and its Numbervalue, clone a button with the information, skips all “Equipped” bool is true folders.
image
EquipItem, Find the “Equipped” bool value from respective folder name and set it to true. Also create an int value with the name as the folder’s name and the value as a backpack hotkey(Not implemented yet)
image
EquippedListScript, handles the EquippedBackpack similarly to the InventoryListScript, for each int value’s name, find corresponding folder in the list of inventories and use its information to make the button.

–Stuck Hell–
The item about to be deleted is equipped, some players may do that.
image
Talk to the receptionist to turn in items, deleting them.


And poof, the folder is gone, but the value still persists
image

yeah seems like the issue is:

you create the EquippedBackpack → Critterfeeder in the client (server doesn’t see or know it exists)
server checks and tries to delete everything inside EquippedBackpack
the item is only visible on the client so the server cannot delete it
then it stays on the client

I don’t think I understand this part, unless it’s because I’m only a month old scripter who uses ChatGPT to carry.
Does this part check for each player
image
then waits for each of those respective players’s folders to dissapear, and sends the respective player’s name to the script.
image

Edit: I just went in to the server to check since I think that’s what you meant, indeed the value was not in the server and instead in the client.
image
Server
image

this confirms that’s the issue.
.

(assuming you’re confused on server and client)
quick (kinda too vague) explanation on how server and client are different and how they communicate:

server is where the game is hosted it keeps track of everything and is trustable but has delays because it is hosted on roblox servers. but cannot access player inputs and a few other stuff.
client is the device the player is using. It’s basically a copy of the game downloaded from the server and run on the device.
If you change/add something on the client using a local script (script that only runs on the client) it won’t happen in the server and will only happen for that player. however if you add/change something in a script (server script) it will update the server and every player’s game with that information aswell.
Reason why client-side isnt used at all (except inputs) in systems like backpack is that exploiters can practically insert their own local script into the game files on their computer. but it doesnt replicate to the server and only happens on their game. this is basically why server and client are seperated
theres also this useful post i found.

Si I tried changing some things like removing the slot assignment from the local script



image

And putting the slot assignment inside the server script like this


Except that’s probably not how it works since I got this error

can you send a repro file? so i can help out

what’s exactly a repro file, I’ve never heard the term before

my bad, save the place as a rbxl file and delete any asset you dont want to share if its unrelated to the script. can you send that here so people can reproduce the issue & help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.