Im just very confused on how you would do this. Would i Need to use a Table?. Would i need to use a function? Just would like some help on this.
Ive tried doing workspace:FindPartOnRayWithIgnoreList, But i dont know what else i could do.
Im just very confused on how you would do this. Would i Need to use a Table?. Would i need to use a function? Just would like some help on this.
Ive tried doing workspace:FindPartOnRayWithIgnoreList, But i dont know what else i could do.
local PartsToIgnore = {}
for _, Dsc in pairs(workspace:GetDescendants()) do
if Dsc:IsA("Part") then PartsToIgnore(#PartsToIgnore + 1) = Dsc end
end
PartsToIgnore should be the 2nd parameter of workspace:FindPartOnRayWithIgnoreList(1, 2, 3, 4)
Got a error
Expected Identifier when parsing expression '='
This is in the Editor itself.
PartsToIgnore[#PartsToIgnore + 1]
excuse me, wrong brackets.
Would i do
local PartsToIgnore = {}
for _, Dsc in pairs(workspace:GetDescendants()) do
if Dsc:IsA("Part") then PartsToIgnore[#PartsToIgnore + 1] = Dsc end
end
workspace:FindPartOnRayWithIgnoreList(NewRay, PartsToIgnore, player.Character)
Ive Created the Ray and everything NewRay is a what im sending from the local script.
All the parts of the character should be in the partstoignore table, presuming that the character is loaded before the table is made.
I dont want it to ignore the character.
Is this code in a localscript?
the code is in a ServerScript.
local Character = player.Character
local PartsToIgnore = {}
for _, Dsc in pairs(workspace:GetDescendants()) do
if Dsc:IsA("Part") and not Dsc:IsDescendantOf(Character) then
PartsToIgnore[#PartsToIgnore + 1] = Dsc
end
end
workspace:FindPartOnRayWithIgnoreList(NewRay, PartsToIgnore)
You have to reference the Character some way.
It insta kills me (even tried doing and Dsc:IsDescendantOf(Character)
)
Sorry, it’s whitelist.
workspace:FindPartOnRayWithWhitelist(NewRay, PartsToIgnore)
Im frustrated as well by my own project, so I’m not thinking clearly.
I hope you do really good on your project, but it says the Whitelist one is not a valid member
FindPartOnRayWithWhitelist (lower letter l of list)
It works amazing thank you. I couldn’t have actually figured this out being the first time im using rays
No problem. Good luck!
SOLVE:
local Character = player.Character
local WhitelistParts= {}
for _, Dsc in pairs(workspace:GetDescendants()) do
if Dsc:IsA("Part") and not Dsc:IsDescendantOf(Character) then
WhitelistParts[#WhitelistParts+ 1] = Dsc
end
end
workspace:FindPartOnRayWithWhitelist(NewRay, WhitelistParts)
Also, im guessing if i wanted to i could do
for _, Dsc in pairs(workspace:GetDescendants()) do
if Dsc:IsA("Part") and Dsc:IsA("MeshPart") and not Dsc:IsDescendantOf(Character) then
WhitelistParts[#WhitelistParts+ 1] = Dsc
end
end
workspace:FindPartOnRayWithWhitelist(NewRay, WhitelistParts)
This is deprecated and could easily be reworked to use Raycast Params instead.