Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why do Players HAVE to collide with npcs?

I have the script that makes players not collide with npcs but I don't know where to put it nor how to make group collisons. Can anyone tell me where to put the script and how to make collison group for npcs?

local PhysicsService = 
game:GetService("PhysicsService")
npcGroup = "npcGroup"
PhysicsService:CreateCollisionGroup(npcGroup)    PhysicsService:CollisionGroupSetCollidable(npcGroup, npcGroup, false) 
local function setCollisionGroupRecursive(object) 
        if object:IsA("BasePart") then 
            PhysicsService:SetPartCollisionGroup(object, npcGroup) 
end
    for _, child in ipairs(object:GetChildren()) do 
        setCollisionGroupRecursive(child)
        end
end
npc = workspace.NPC
setCollisionGroupRecursive(npc)

6 comments

0

So you made this or did you not. If you didn't make this, you need to not rush yourself in learning. Your learning pace is obviously slower than this.

0

I made this out of what others told me on a vid on YT and so far nothing is helping me about this problem

0

This proves that YouTube videos don't work. They don't help you learn. There are no good YouTube channels yet. The only thing YouTube videos do is spoon feed. They just tell you to copy what is written without actually explaining. You should take a step back, and come back to this when you're more confident

0

How does that help me? That makes me a little offenced

0

Aka discouraged

0

This code should work fine, but it's setting up for things in the npcGroup to not collide with each other. So NPCs will be able to pass right through other NPCs. You could make a playerGroup, set that to not collide with the npcGroup, and then set all parts of a player model to the playerGroup the same way you're doing here for the NPCs.

1 answer

rlly just do this

NPC.HumanoidRootPart.CanCollide = false

This discussion is preserved as it was. New answers, comments, and votes are closed.