I'm trying remove collision of my head to look same this: GIF
Current script
local Players = game:GetService('Players') local PS = game:GetService('PhysicsService') local PlayerGroup = PS:CreateCollisionGroup('Player') PS:CollisionGroupSetCollidable('Player','Player',false) function NoCollide(Character) for i,v in next, Character:GetChildren() do if v:IsA("BasePart") and v.Name == 'Head' then PS:SetPartCollisionGroup(v,'Player') end end end Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(chr) NoCollide(chr) end) end)
I got no errors
Well, first, the Head is actually a Part and not a BasePart. Second, I would go for the route of printing to see where the error is, because with stuff like :IsA("???") as long as what's in the quotes exists as something ROBLOX has, it's not going to give an error; it's kind of like how :FindFirstChild("???") won't give an error. Third instead of doing the whole CollisionGroupSetCollidable, I would just set v.CanCollide to false. Fourth, next is somewhat deprecated, so just use pairs instead. Here's what I did to fix your code, tell me if it helped:)
local Players = game:GetService('Players') function NoCollide(Character) for i,v in pairs(Character:GetChildren()) do if v:IsA("Part") and v.Name == 'Head' then v.CanCollide = false else v.CanCollide = true end end end Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(chr) NoCollide(chr) end) end)