:GetChildren/Descendants() aint working?

im working on an fps and i want to make it so when the player equips a gun, all surface and billboard guis are deleted from the server copy of the gun to prevent situations where for example you can see both the local sight and the server sight:

so imade this simple code (its in a local script):
image

(Item is a folder where the server copy of a gun is stored)
but for some reason it returns this:
image

what could be going on?

The only idea that I have is that you are checking the new child for decendants but not its parent. I may be completely wrong but that’s what I’m getting…

1 Like

im not sure if i understood you correctly, but replacing child:GetDescendants() with char.Item:GetDescendants() didnt work either

1 Like

Where exactly are the SurfaceGuis and BillboardGuis located? And where is your server copy of the gun located?
Edit: And does your gun include any child, because in the output, it appears there are 0 children/descendants in your copy gun.

the server copy is in the Item folder inside of the Character and the surface gui is located in the gun sight:
image
and there are 2 sights visible on my screen so it definetly has more than 0 children

Are you cloning the gun on the server or the client, and is the given code (that is supposed to delete the SurfaceGui and BillboardGui) in a LocalScript or Server script? Also, have you confirmed that you are cloning the correct instance?

the server copy is cloned on the server, the deleting script is a local script and yeah i am cloning the correct instance

Maybe try using a Server script instead of a LocalScript. See if that could maybe make a difference.
When in game, check your Item folder from the Explorer tab to see if anything has been added to that folder, and check if there’s any children/descendants under the instance.

1 Like

well it works


but now no one can see the sight except for me
image
which honestly isnt really a big deal, but its not ideal and it could become a problem later in the game with more detailed guns or something

1 Like