Help with the new collision system

So, a part of the script are now obsolete and I tried to use the new collision commands but it gave me attempt to call a string value error, this is the code I tried using:

for i, object in ipairs(newEnemy:GetDescendants()) do
				if object:IsA("BasePart") then
					object.CollisionGroup("Mob")
1 Like

In which script/line that error happens?

Whats the problem with the script you are showing?

There are three places where this error happened which are in different scripts but all of them use the same code( well the same code but with different variable). They are line 18 of main controller, line 83 of placement controller and line 34 in enemy controller. The problem is I tried setting the collision group of three things which are players and two other game element but due to this error, it breaks the entire script.

CollisionGroup is a property of objects, to change it: you can just set it as if it were any other string property (ex: name, text, etc)

BasePart.CollisionGroup = "Collision_Group_Name"

Does it have to be BasePart or just the variable wanted?

BasePart is just a placeholder variable, any variable name will do so long as it’s attached to a BasePart instance.

what ever you reference the part you want to apply the collision group onto

That worked, I am no longer getting the error massage.

1 Like

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