P_YStudio

Improve Your Obbies Part 1

Mar 2nd, 2023
1,591
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | Source Code | 0 0
  1. local PhysicsService = game:GetService("PhysicsService")
  2. local Players = game:GetService("Players")
  3.  
  4. PhysicsService:RegisterCollisionGroup("Characters")
  5. PhysicsService:CollisionGroupSetCollidable("Characters", "Characters", false)
  6.  
  7. Players.PlayerAdded:Connect(function(player)
  8.    
  9.     player.CharacterAdded:Connect(function(Character)
  10.        
  11.         for _, Part in pairs(Character:GetDescendants()) do
  12.            
  13.             if Part:IsA("BasePart") then
  14.  
  15.                 Part.CollisionGroup = "Characters"
  16.  
  17.             end
  18.            
  19.         end
  20.        
  21.         Character.DescendantAdded:Connect(function(Part)
  22.            
  23.             if Part:IsA("BasePart") then
  24.                
  25.                 Part.CollisionGroup = "Characters"
  26.                
  27.             end
  28.            
  29.         end)
  30.        
  31.     end)
  32.    
  33. end)
Advertisement
Add Comment
Please, Sign In to add comment