How to get all parts in workspace

Hello, I’m making a custom part render for my game. I need to get all parts in workspace once the game starts, but get it on local client.

So, I need somehow to get parts from workspace in the beggining of server and once the server is starting. I could use Ccript, but I need it in LocalScript. Is there any posibility of completing
this?

3 Likes

try this, it is a table

local workspaceChildren = workspace:GetChildren()
4 Likes
local x = workspace:GetDescendants()
-- for every single object in workspace
4 Likes

You can use workspace:GetDescendants() for all the children and children of that child in the workspace or workspace:GetChildren() for all the children in the workspace but not the children in that child.

If you want just a specific item use :IsA()

Example code:

for _, child in pairs(workspace:GetDescendants()) do
if child:IsA("BasePart") then
print(child.ClassName)
end
end

Hope I helped!

5 Likes

First of all, thanks to all who answered. However, I’m not noob in programming and my problem was more complicated and it was about not getting all parts at the moment, but about finding them in the initial server start and then transfer to client. I found solution to my problem myself, but thanks anyways.

1 Like

Sorry for the late reply, but I’ve been trying to make a script that gets every single part in the workspace, and filter through it at the start of the player joining. Do you mind explaining or sharing a source that you used to make it?