so i have a script:
local function registerCollisionGroup(player)
local collisionGroupName = player.Name
local collisionGroup = game:GetService("PhysicsService"):RegisterCollisionGroup(collisionGroupName)
return collisionGroup
end
local PhysicsService = game:GetService("PhysicsService")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local collisionGroup = registerCollisionGroup(player)
PhysicsService:CollisionGroupSetCollidable(tostring(player.Name),"NoPlayer", false)
for _,part in pairs(char:GetDescendants()) do
if part:IsA("BasePart") then
part.CollisionGroup = tostring(player.Name)
end
end
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
PhysicsService:UnregisterCollisionGroup(player.Name)
end)
this gives the player a custom collision group. how would i disable collision with other players? i tried looping:
local function registerCollisionGroup(player)
local collisionGroupName = player.Name
local collisionGroup = game:GetService("PhysicsService"):RegisterCollisionGroup(collisionGroupName)
return collisionGroup
end
local PhysicsService = game:GetService("PhysicsService")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local collisionGroup = registerCollisionGroup(player)
PhysicsService:CollisionGroupSetCollidable(tostring(player.Name),"NoPlayer", false)
for _,part in pairs(char:GetDescendants()) do
if part:IsA("BasePart") then
part.CollisionGroup = tostring(player.Name)
end
end
while true do
for _, group in ipairs(game:GetService("PhysicsService"):GetRegisteredCollisionGroups()) do
if group.name ~= "Default" and group.name ~= player.Name.. "ball" then
game:GetService("PhysicsService"):CollisionGroupSetCollidable(collisionGroup,group.name,false)
end
end
wait(1)
end
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
PhysicsService:UnregisterCollisionGroup(player.Name)
end)
which didnt’s work, help would be greatly apperciated