GetCollisionGroupName & SetPartCollisionGroup & CreateCollisionGroup is deprecated

SetPartCollisionGroup is deprecated

image

I have 2 scripts which does the same job and
I need suggestion with which one is better to use.

  • And need to fix this SetPartCollisionGroup is deprecated error in them.
    – Script 1.
    image
    – Script 2.

    image

=========================

GetCollisionGroupName is deprecated

image

  • This error is coming from Script 2. I showed above.

    =========================
    If that SetPartCollisionGroup & GetCollisionGroupName is supposed to be replaced with something else then please do let me know, I will do it quickly and show it here if there are any errors.
    =========================

CreateCollisionGroup is deprecated

image

  • After pressing ctrl+shift+f I searched "CreateCollisionGroup " but I did not found it anywhere in any script.
  • But when I run a test play and searched " CreateCollisionGroup " then it did showed up in some script named " MainVariables " for few seconds and then the script was gone.
    =========================
    Some doubts:
  • Are these errors are affecting game in bad way?
    =========================
2 Likes

Firstly, the category should be #help-and-feedback:scripting-support

Secondly, all the information about deprecated functions are on the Documentation site.



Sorry for the category, its like my first post created so I didn’t really looked into that.

Also the documentations I will start reading but what u think about which DisablePlayerCollisions Script should I use?

Not sure what you mean. You can set Parts’ collision group by setting Part.CollisionGroup = CollisionGroup

I tried but its showing errors, can u tell me what exactly changes I have to make here?

script.Parent = game:GetService(“ServerScriptService”)
local PhysService = game:GetService(“PhysicsService”)
local PlayerGroup = PhysService:RegisterCollisionGroup(“p”)
PhysService:CollisionGroupSetCollidable(“p”,“p”,false)

function NoCollide(model)
for k,v in pairs(model:GetChildren()) do
if v:IsA"BasePart" then
PhysService:SetPartCollisionGroup(v,“p”)
end
end
end

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
char:WaitForChild(“HumanoidRootPart”)
char:WaitForChild(“Head”)
char:WaitForChild(“Humanoid”)
wait(0.1)
NoCollide(char)
end)

if player.Character then
	NoCollide(player.Character)
end

end)

v.CollisionGroup = p

image
Like this? correct?

Yes.

Thank so you much for helping me, it removed all those errors :smiley:

1 Like

What about “:CreateCollisionGroup()”?

GetCollisionGroupName()NO REPLACEMENT FOR THIS, RECOMMENDED TO USE THE NAME INSTEAD OF ID

SetPartCollisionGroup(part, name)part.CollisionGroup = name

CreateCollisionGroup(name)RegisterCollisionGroup(name)

Use RegisterCollisionGroup()

1 Like

As of now, not really. However, if Roblox decided to remove those functions (because they’re deprecated), it will cause errors to the script and the Collision Groups won’t work.

thank you, I appreciate it man!

The deprecation warnings you’re encountering are due to Roblox updating its APIs over time. The deprecated functions are no longer recommended for use, and you should update your scripts to use the newer alternatives. Let’s address each of the points you mentioned:

  1. SetPartCollisionGroup Deprecated: Instead of using SetPartCollisionGroup, you should use the Part:SetCollisionGroupId method. Here’s how you can modify your scripts:Script 1:

luaCopy code

-- Replace this line:
-- v.CollisionGroup = p

-- With this line:
v:SetCollisionGroupId(p)

2.Script 2:*

luaCopy code

-- Replace this line:
-- group = p:GetCollisionGroupName()

-- With this line:
group = p:GetCollisionGroupId()
  1. GetCollisionGroupName Deprecated: You’re already using the correct method to get the collision group name, which is GetCollisionGroupId. However, you’re storing the group name in the group variable, so make sure you’re using this variable correctly later in your code.
  2. CreateCollisionGroup Deprecated: CreateCollisionGroup is deprecated, and you shouldn’t use it. Instead, use PhysicsService:CreateCollisionGroup to create collision groups. Here’s how you can create a new collision group:

luaCopy code

local collisionGroupId = game:GetService("PhysicsService"):CreateCollisionGroup("GroupName")

Make sure to replace "GroupName" with the desired name for your collision group.

These deprecation warnings are important to address, as using deprecated functions may result in issues or unpredictable behavior as Roblox updates its systems. While the warnings themselves might not directly impact the functionality of your game at the moment, it’s a good practice to update your scripts to use the latest and recommended methods to ensure your game remains stable and compatible with future updates.

GetCollisionGroupId() is also deprecated.

CreateCollisionGroup() should be replaced by RegisterCollisionGroup().

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.