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

Find Closest Humanoid Not Work Why?

Asked by
gmod419 23
5 years ago

So this script makes a Part and then finds all other parts inside said Part then locates the Humanoids, I plan to make it so the localplayer's humanoid is ignored, but the For i, v in pairs loop doesn't even work idek why.

    Player = game:GetService("Players").LocalPlayer
    Mouse = Player:GetMouse()

    Mouse.Button1Down:Connect(function()
        if Player.Character then
            local Part = Instance.new("Part", Player.Character)
            Part.Anchored = true
            Part.CanCollide = false
            Part.Size = Vector3.new(25, 25, 25)
            Part.CFrame = Player.Character.Head.CFrame
            print("Part Created")
            for i, v in pairs(Part:GetTouchingParts()) do
                print("Loop Started")
                local IfHumanoid = v.Parent:FindFirstChild("Humanoid")
                if IfHumanoid ~= nil then
                    print("Found Humanoid")
                end
            end
        end
    end)    

It Doesn't print "Loop Started" in the output

0
I feel like its a stupid mistake gmod419 23 — 5y
0
does it print part created Elixcore 1337 — 5y
0
yes gmod419 23 — 5y
0
that means there are no touching parts Elixcore 1337 — 5y

Answer this question