#looping through a folder
1 messages · Page 1 of 1 (latest)
local Position = script.Parent.Parent.Mouth2.Position
local Direction = script.Parent.Parent.Mouth2.CFrame.LookVector * 100
local rayresult = workspace:Raycast(Position,Direction)
local raycastparams = RaycastParams.new()
raycastparams.FilterDescendantsInstances = {workspace.Plants.Peashooter}
raycastparams.FilterType = Enum.RaycastFilterType.Exclude```
my script rn
i mean i tried it didnt rlly work
for i,v in plants:GetDescendants() do if v:IsA(“Part”) then code end end
plants being a variable for the folder
notice this only tags the parts not baseparts which include stuff like spheres, wdges and other
how am i supposed to get "v" out side the scripts then
bruh wlr
local x
for i,v in plants:GetDescendants() do
if v:IsA(“Part”) then
code x = v
end
end
more code
u can
inside the raycast filtertype thing
o
arent u supposed to return it
I thought u meant u just needed the parts
well then u could put it in a function and return v
the function will then become v
could you teach me how to do that
local function raycastParts()
the for loop
return v
end
end
end
then the function itself will refer to v
hypothetically, use folders for what they're for
so you could then type
put all things of the type you want into a singular folder
print(raycastParts().Name)
uh
its not working somehow...
this
the property of raycastparams is named filterDescendantsInstances, if you just add the folder then everything under the folder in the hierarchy will get ignored
You mean doing workspace.plants instead?
yeah
** You are now Level 17! **
The peashooter is somehow still shootig
No it's before
Still ain't working
Ok so this is what I tried
I put string values in the peashooter itself named plant and string values in the dummies named zombies
When the dummy is on the exact lane the peashooter behind is supposed to print is a zombie, however it somehow doesn't detect it
And note the dummy isn't inside workspace.gardens so idk what's going on