Part that stops humanoid but not raycasting

I’ve got a scenario that I’m not too sure how to resolve.

Player humanoids are on top of a big cube part. I need to stop them walking off the edge. At the same time, I need them to be able to shoot off the ledge, including (effectively) straight down the side of the cube/building.

Pathing would respect this. So if I was at the top edge, and clicked at bottom, it wouldn’t attempt to walk/jump off the edge, but instead go another way (eg stairs or ramp etc).

I’ve considered having an invisible wall to stop them walking off, but this will stop the shooting.

Could I have a touch detector that if touched would limit movement in certain directions?
Can the raycasting be configured to ignore certain parts? eg the invisible wall?

Perhaps a shin height invisible wall, with jumping disabled? This will stop the player, but hand-held guns will shoot over it. Not ideal, as at some angles bullets will hit this wall.

thanks

Hello, Did you try making an invisible wall and using the touch event to see if the parts name is “Bullet” or the name of ur bullet and turn can collide off else if its a humanoid then turn can collide on?

No, I’ve not tried that. I’ll have a play with it. My fear is the rate of fire is quite high per player. With 8 players potentially all shooting.

Anyways its worth a try!

{30 Chars}

FindPartOnRayWithIgnoreList allows you to pass in a table of objects to ignore. It’s identical to FindPartOnRay, but it ignores anything in the table. You can make invisible walls, and make a table of those walls and use it to ignore.

I hope this is what you’re looking for.

2 Likes

O. I completely forgot that this existed lol. Yes, @Fire540Games is right. You can use FindPartOnRayWithIgnoreList. @BrisDeveloper