Im trying to make a script that searches all around the pivot point and tag the objects that has "collectable" scrip in it. How can i make the script search for "Collectable" script in the objects?
✓ ANSWER ACCEPTED
How to make search the object have spesific part or script in the Workspace?
1 answer
✓ Accepted answer
If I understood your question, you should be using a for loop. Loop through Workspace and see if it has any children called Collectable. I made a function that will return all collectable items in a table.
local function GetCollectableItems()
local items = {}
for i,v in pairs(workspace:GetChildren()) do
local Collectable = v:FindFirstChild("collectable")
if Collectable then
table.insert(items, v)
end
end
return items
end
2 comments
0
Thank you So much!
0
no problem
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Please provide us with your attempt even if the code is not functional.