I am working on a project were I need to change the collision group ID. I tried two ways in my scripts but neither are working please help.
game.Players.PlayerAdded:connect(function(player)
local character = workspace:FindFirstChild(player.Name)
for i,v in pairs(character:GetChildren()) do
if v.ClassName == "MeshPart" then
wait(.01)
v.CollisionGroupId = 2
end
end
end)
and
game.Players.PlayerAdded:connect(function(player)
for i,v in pairs(player.Character:GetChildren()) do
if v.ClassName == "MeshPart" then
wait(.01)
v.CollisionGroupId = 2
end
end
end)

3 comments
Read this wiki article about and how to use CollisionGroupId: http://wiki.roblox.com/index.php?title=Collision_Filtering . Also, when you want to access the Player's Character, you would do player.Character, not find their name in the workspace, as there might be another instance of the same name.
I used a collision group plugin where all I need to do is change the value of the collision group. When I changed it manually In game it worked though through the script it doesn’t
I used a collision group plugin where all I need to do is change the value of the collision group. When I changed it manually In game it worked though through the script it doesn’t