How would I make this stop happening?

Hey Developers,

How would I prevent this gun from going though walls (apart from making the wall thicker) and make it so that when a player walks up to the wall they would not be able to put the gun though the wall?

image

You have to enable collsion if you want it to stop, hmu if it doesn’t satisfy you!

thanks for replying, I tried out enabling collision but it still isn’t working?
image

What is it? Model, mesh or union?

Is CanCollide on the wall set to true?

a Union inside a tool
image

1 Like

the wall and the gun both have cancollide set to true

Okay, I can’t help you any further! I don’t have any knowledge in this field.

1 Like

Check the CollisionGroupIds of both the wall and union. Are they both set to 0?

workaround: make the wall thicker, or add a thicker transparent part with collision on

weld a part to the player’s hand the width of the tool

I have a few ideas in mind.

  1. Try welding a part with collisions on, massless that covers the entire gun.
  2. Add an invisible part to the wall so the gun doesn’t go past that
  3. (bad method) Position the gun behind the users arm or something
  4. (even worse method) Physically prevent the player from walking closer to the wall so their gun doesn’t go through the wall

Hopefully one of these methods will help you out. I’ve never really tried doing this myself but, I’m sure you will find a solution.

2 Likes

This is a hard solution, but can look good.

Raycast from the arms position in the direction of the gun.
If the raycast hits a wall, make the character put the gun up or down and preven him/her from firing.

Have you looked to see if the gun is CanCollide on when you Test it in Studio? Make sure you check the tool in the Character (your avatar name) in the Workplace, not in the Players folder.

How big is the Handle’s Mesh? If it is a tiny .2x.2x.2 Part That may be the issue. If they aren’t the same size try making the Handle physically match the size of the visual gun.