You would have to go part by part to set the player character’s collision group to anything other than default.
CharacterAdded.Connect(function(character)
for _, part in ipairs(character:GetDescendants()) do
if part:IsA("BasePart") then
-- set part collision group (part, your_group)
end
end
end)
local PhysicsService = game:GetService("PhysicsService")
local obstacles = "Obstacles"
local greenObjects = "GreenObjects"
-- Create two collision groups
PhysicsService:CreateCollisionGroup(obstacles)
PhysicsService:CreateCollisionGroup(greenObjects)
-- Add an object to each group
game.Players.PlayerAdded:Connect(function(plr)
local characterr = plr.Character or plr.CharacterAdded:Wait()
characterr:Connect(function(character)
for _, part in ipairs(character:GetDescendants()) do
if part:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(part, obstacles)
end
end
end)
end)
PhysicsService:SetPartCollisionGroup(workspace.Ball, greenObjects)
PhysicsService:CollisionGroupSetCollidable(greenObjects, obstacles, false)
Delete this line, Models do not have a Connect function, nor do you want to connect to any event.
game.Players.PlayerAdded:Connect(function(plr)
local characterr = plr.Character or plr.CharacterAdded:Wait()
for _, part in ipairs(character:GetDescendants()) do
if part:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(part, obstacles)
end
end
end)