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

How can I make NPCs "pass through" players?

Asked by
Klamman 220 Moderation Voter
8 years ago

I'm doing some work with AI and have been having quite a few problems. If I could get the result seen in the video linked below, however, it would solve a few of them. How can I make NPCs pass through players like shown here?

Video

Is the creator setting a CanCollide property to false for a second, forcing the player upward? I'm not really asking for code, just an explanation as to what properties they're changing so that I can attempt to replicate it. Thanks in advance.

0
With filtering enabled they can set the NPC to cancollide false on the client, this would then mean the client would not collide with the NPCs if the NPCs Physics are handled on the server. Might not be what they've done, however it is a solution. DevSean 270 — 8y

1 answer

Log in to vote
-2
Answered by 8 years ago
for i,v in pairs(game.Workspace:GetChildren()) do
    if v.Name == "NPC" then
        for a,b in pairs(v:GetChildren()) do
             b.Touched:connect(function(hit)
                if b.hit then
                    b.CanCollide = false
                end
            end)
        end
    end
end

I dont know if this will work but I gave it my best shot.

Ad

Answer this question