I simply want the NPC’s to stop colliding with the players. I tried printing to check if the code is running and everything was fine and I also tried searching everywhere on the internet but nothing work. (no errors in the output)
code:
--// Physics
PhysicsService:CreateCollisionGroup("NPC")
PhysicsService:CreateCollisionGroup("PlayerParts")
PhysicsService:CollisionGroupSetCollidable("PlayerParts","NPC",false)
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
repeat wait() until char and #char:GetChildren() >= 16 or #char:GetChildren() >= 8
for i,v in pairs(char:GetChildren()) do
if v:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(v,"PlayerParts")
end
end
end)
end)
for i,v in pairs(game.Workspace:WaitForChild("Store").NPCs:GetChildren()) do
if v:IsA("Model") then
for _,part in pairs(v:GetChildren()) do
if part:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(part,"NPC")
end
end
end
end