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

Why do Players HAVE to collide with npcs?

Asked by 4 years ago

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)
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. programmerHere 371 — 4y
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 User#30241 0 — 4y
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 programmerHere 371 — 4y
0
How does that help me? That makes me a little offenced User#30241 0 — 4y
View all comments (2 more)
0
Aka discouraged User#30241 0 — 4y
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. EmilyBendsSpace 1025 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

rlly just do this

NPC.HumanoidRootPart.CanCollide = false
Ad

Answer this question