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

Why when the part touches another part the script doesn't work?

Asked by
Prioxis 673 Moderation Voter
9 years ago

So I have a part that follows my characters torso (anytime the torso moves the part moves to encase a large area around the character like a hitbox without collision) and if the "hitbox" touches a part that have a child named ItemName then print the parents name but nothing is happening

script.Parent.Touched:connect(function(hit)
    local found = hit:FindFirstChild("ItemName")
    if hit.Parent == nil then
        if found then
            print(found.Parent.Name)
        end
    end
end)

Answer this question