players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local function setGroup(part)
if part:IsA("MeshPart") then
part.CollisionGroup = "Players"
end
end
char.ChildAdded:Connect(setGroup)
for i, charPart in pairs(char:GetChildren()) do
if charPart:IsA("MeshPart") then
charPart.CollisionGroup = "Players"
end
end
end)
end)
No Errors, Nothing in the output.
It just doesn’t work.
I’ve tried setting up the “Player” group through a script aswell, but this didn’t change anything.
What am i doing wrong? Any help is greatly appreciated!
Try this, sometimes the body parts won’t be a mesh part and do GetDescendants instead of GetChildren (BaseParts also contain MeshParts)
players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local function setGroup(part)
if part:IsA("BasePart") then
part.CollisionGroup = "Players"
end
end
char.DescendantAdded:Connect(setGroup)
for i, charPart in pairs(char:GetDescendants()) do
if charPart:IsA("BasePart") then
charPart.CollisionGroup = "Players"
end
end
end)
end)