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

Someone pls help with this error? invalid argument #1 to 'find' (table expected, got Instance)

Asked by 1 year ago

--Hitbox Script Start

local function hb(size, cframe, ignore, char) local hb = Instance.new("Part", workspace.Fx) hb.Anchored = true hb.CanCollide = false hb.Transparency = .6 hb.Name = "hb" hb.Material = Enum.Material.ForceField hb.CanQuery = false hb.Size = size hb.CFrame = cframe

local con
con = hb.Touched:Connect(function()
con:Disconnect()
end)

local lasttarg

for i,v in pairs(hb:GetTouchingParts()) do
    **if v.Parent : FindFirstChild("Humanoid") and table.find (ignore, v.Parent) == nil then**
        if lasttarg then
            if (lasttarg.Position -  char.PrimaryPart.Position).Magnitude > (v.Position -  char.PrimaryPart.Position).Magnitude then
                lasttarg = v.Parent.PrimaryPart
            end
        else
            lasttarg = v.Parent.PrimaryPart
        end
    end
end

hb:Destroy()
if lasttarg then
    return lasttarg.Parent
else
    return nil
end

end --HitBox Script Endin

Having trouble with bold line pls help

0
change v.Parent to v.Parent:GetChildren() T3_MasterGamer 2189 — 1y

Answer this question