Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How do you filter out instances by its name? Properties?

Asked by 9 years ago

Not asking for a script but tried to look all over roblox wiki, i couldn't find it.

What I mean by filter out instances by property is the part only get edited when it has a certain name or something. For example: There are 3 parts named "Blocky" and other parts named different and 3 of those parts can be edited by script because it has the certain name.

I am gonna use this for recoil patterns

    for _,w in pairs(rpattern) do
            if w:IsA("Vector3Value") then           
                if tonumber(w.Name) == 5 then -- This is the filter. If the name is 5 then below gets activated using w's or rpattern's properties.
                    rnum = rnum + 1
                    local camrot = cam.CoordinateFrame - cam.CoordinateFrame.p
                    local camscroll = (cam.CoordinateFrame.p - cam.Focus.p).magnitude           
                    local rcl = CFrame.new(cam.Focus.p) * camrot * CFrame.fromEulerAnglesXYZ(w.Value)
                    cam.CoordinateFrame = rcl*CFrame.new(0, 0, camscroll)
                end
            end
        end 

heres the code i have so far just incase you want to help me

I'd really like it more if you answer how to filther instances by its properties (size, vector3, color, etc.).

0
You have to explain what you mean. Filter a list? Which are you interested in the first place? All of them? All of them in a model? Only children of a model? Do you only want ONE answer or do you want ALL of the things that match? BlueTaslem 18071 — 9y
0
edited. Happy? ;3; supermarioworld323 45 — 9y
0
Have you tried setting up the 'if' statement on line 3 to see if the Value's Name is a Number ('tonumber' can convert a string-number to a number-number, but can also return a 'bool', I think)? :) TheeDeathCaster 2368 — 9y

1 answer

Log in to vote
-1
Answered by 9 years ago

well, its really simple, so you kinda have an idea. you made it overly complicated. i was thinking like in the explorer only showing certain instances without outside uses for this, you want to use tables, basically

local workspacestuff = worspace:getChildren()
local checkmodels = false --change this if you want it to go through models as well
 for n, p in pairs(workspacestuff) do
if p:IsA("Model") and checkmodels == true then
for n2, p2 in pairs(p:GetChildren())do
if p2.Name == "wat" then
--code
end
end
else
if p.Name == "wat"
--code
end
0
I want an answer, not another question please. supermarioworld323 45 — 9y
0
i gV YOU A POSSIBL ANSWER. BUT THAT IS SO BROAD, FILTER OUT WHERE. THAT IS THE THING YOU SHOULDA ADDED. i did not realize caps was on, sorry. TheGreatRobloxianWar 0 — 9y
0
K I edited, can you give me an answer now? supermarioworld323 45 — 9y
0
yes TheGreatRobloxianWar 0 — 9y
View all comments (3 more)
0
tell me if there was anything you want added TheGreatRobloxianWar 0 — 9y
0
Exactly what I was looking for! supermarioworld323 45 — 9y
0
awesome TheGreatRobloxianWar 0 — 9y
Ad

Answer this question