Make a Part NotCollide with another Part, but Player Collides? (Collision Groups)

I have collision groups made for “players” , “ball” and “walls”

I have a minigames place and for one of them, balls (rocks) roll down a hill and players must avoid them. i have invisible walls so the players cannot climb the hill, but i want the balls to go through the walls.

can anyone assist me on how to achieve this? I have already made the collision groups but it won’t work, and this is probably because I don’t have a script with it, but I am unsure of how to structure the script to get it to work properly.

image
image
image

1 Like

All you need to do is assign the appropriate collision group to the each wall and ball.

local walls = {} -- table of wall parts
local balls = {} -- table of ball parts

for wall in walls do
    wall.CollisionGroup = "walls"
end

for ball in balls do
    ball.CollisionGroup = "ball"
end

If you don’t have a static table of balls and they are created as the game progresses, just set the collision group right after instantiating it.

2 Likes

Im marking this as solution because this seems it should work, however I used a different method of a NoCollisionConstraint in the ball and that works fine so far.

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