Just found the fix lol, well, almost definite fix.
for _,v in pairs(workspace.CharactersFolder.:GetDescendants()) do
if v.Parent:IsA(“Accessory”) then
v.Size = Vector3.new(0,0,0)
end
end
Just found the fix lol, well, almost definite fix.
for _,v in pairs(workspace.CharactersFolder.:GetDescendants()) do
if v.Parent:IsA(“Accessory”) then
v.Size = Vector3.new(0,0,0)
end
end
Unless u guys have an even better solution this is the best i could find, thanks for ur input
Well, 2 people (@artfvl & @AdvancedDrone) have now mentioned that you could add the accessory to the ignorelist to make it work.
if Descendant:IsA("Accessory") then table.insert(IgnoreList, Descendant) end
I did that and it didnt make a difference
If IgnoreList doesn’t work with FindPartOnRayWithIgnoreList then there might be something wrong with the code.
Uh you know you could of done this incase it hits the hats :
local damages = {
Head = 15,
Torso = 10,
Else = 5
}
local torsoTypes = {
UpperTorso = true,
LowerTorso = true,
Torso = true,
HumanoidRootPart = true
}
local function getDamage(hit)
if not hit then return end
if hit and ((hit.Parent and hit.Parent:IsA("Accessory")) or hit:IsA("Accessory") or hit.Name == "Head") then
return damages.Head
end
if torsoTypes[hit.Name] then
return damages.Torso
end
return damages.Else
end
If you’re checking if it’s an Accessory and the user fires the gun at their BackAccessory, it would still register as a head shot. I would recommend checking if Hit has a HatAttachment (or whatever Attachments are on the head).
Uhh idk how this got bumped, was definitely something wrong with my code back then but I have a simple trick to getting around hitting accessories.
local ig = {} -- ignore list
function Raycast(p1,p2,dist)
local ray = Ray.new(p1, (p2 - p1).unit * dist)
local part, position,normal = workspace:FindPartOnRayWithIgnoreList(ray, ig, false, true)
if part.Parent:IsA("Accessory") then
table.insert(ig,part) -- adds to the ignore list
return Raycast(p1,p2,dist) -- do the raycast again
else
return part,position,normal
end
end
Bumping this thread because while it works, now there are newer and better methods than recasting the ray and performing an if statement check.
Now you can just add the accessory to a collision group or disable CanQuery for them to make raycast just not hit them at all.
Works for both new and old raycast methods as by default they are in the Default collision group.