I have a npc but i dont want to cancollide with players

I think video explain itself. (Btw every players have their own npc)

I tried to do this:

for _, v in pairs(game.Players:GetDescendants()) do
	if v:IsA("BasePart") then
		game:GetService("PhysicsService"):SetPartCollisionGroup(v, "NPC")
	end
end

but it didnt work.

This API Reference will help you a bit further.

Thanks but i dont think thats gonna solve my problem.

There’s not enough info for me to help solve your problem, sorry.

it’s not working because you didn’t really get the players character.

local function SetCollision(Character)
for i,v in pairs(Character:GetDescendants()) do
if v:IsA("BasePart") then
game:GetService("PhysicsService"):SetPartCollisionGroup(v, "NPC")
end
end
end

for _, v in pairs(game.Players:GetPlayers()) do
SetCollision(v.Character)
end

Where should i put this code, i try to put in LocalScript and ServerScript both of them didnt work.

What info do you want i can give any info