Hey Developers my Collision group script is now deprecated and I was wondering how I could change it to no longer be deprecated? Heres the script
local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
for i, object in ipairs(player:GetDescendants()) do
if object:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(object, "Players")
end
end
end)
I know that “SetPartCollisionGroup” Needs to be changed to object.Collision group but I’m unsure how to do this since the devforum post didn’t explain well enough for me to understand it.
This should work: local PhysicsService = game:GetService(“PhysicsService”)
local Players = game:GetService(“Players”)
Players.PlayerAdded:Connect(function(player)
for i, object in ipairs(player:GetDescendants()) do
if object:IsA(“BasePart”) then
object.CollisionGroupId = PhysicsService:GetCollisionGroupId(“Players”)
end
end
end)
if object:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(object, "Players")
end
with this
if object:IsA("BasePart") then
object.CollisionGroup = "Players"
end
Also put your script in a characteradded event.
Player.CharacterAdded:Connect(function(Character)
-- Load their character after it died
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.Died:Connect(function()
Player:LoadCharacter()
end)
-- Wait for character to be parented to workspace
repeat
task.wait()
until Character.Parent ~= nil
-- Loop through all character limbs and make player non-collideable
for _, Object in Character:GetDescendants() do
if not Object:IsA("BasePart") and not Object:IsA("MeshPart") then continue end
Object.CollisionGroup = "Players"
end
end)