Problem with barrel that should explode with a bullet

The first thing is:
-I am creating an instance in the workspace camera. but the question is: do the instances that are inside the workspace camera receive CanTouch?
It is that when the player fires a bullet, the bullet is created but in the camera of the work space but not in the work space so the barrel does not detect that. The truth is I don’t know what the problem is please if you have doubts tell me and Don’t tell me to be more specific, just tell me that you don’t understand

I don’t think you can interact with stuff inside the camera.

1 Like

Ok, i will follow what you said:

I don’t really understand what you mean, so tell me if I’m wrong:
Your scenario is:
You are creating a bulletin under the wrokspace canera, and the barrel doesn’t detect the gullet, right?
If you give me a moment I’ll experiment with instances I’m under the canera

Edit: I created a part under the camera and put a script that when it’s touched it prints something, strangely, it exists on the Srrver but not on the Client, and it was printing for no reason, so probably that’s the orobelm

1 Like

and you don’t know how I could solve it? I don’t know how bro please tell me

I was answering one question, I don’t have the answer to the other.

but also, I was told that if its not in the workspace or not a viewmodel type object, then no.

but my question is that it is a bullet which removes the damage to the player, I think there should be an event which executes that without problems… I don’t know how CanQuery

Bullets need to be in the workspace to interact with everything else.

Touched can be a problem with fast moving objects like bullets. You’re probably better off to use Raycasting to find out the target position, then deal the damage to the object that was hit.

What do you mean by that? What do you mean with

? Sorry I’m not understanding, and also, why are you even trying to spawn something under the camera? Is there any specific need for that?

Yeah you should just parent it to workspace.

It is a bullet which must be there and I need it to explode when it hits a barrel

Yea, but the question is WHY should it be there? I’m still not understanding, please explain more in detail, like:
It has to be there because else it will epxlode

the problem is that it’s a blah therefore it goes fast and it must be on the camera so as not to affect the performance of the game so much…
My question is: how would I make it interact with the barrel?

Try that Search button up top. I typed in “bullets don’t hit target” and got these results.
If you change the wording I’ll bet you get even more answers.

As I already said, Touched is horrible when using it for fast moving items.

2 Likes

If it hits where it should be, but the problem is that it doesn’t interact with the barrel, do I make myself understand?

So you need the bullet and it has to be visible in the camera? Or it always has to be seen on the camera? If it’s the first then you don’t need to do eBay thing except setting the parent to Workspace, for the second you have to use some kind of scripts that set the camera position

1 Like

But fast items don’t always register Touched so they don’t always hit the target.
It’s explained in the posts I linked for you.
Raycasting instantly (or as close as possible) recognizes the hit item.

Thank you for your help, friend

1 Like

For that the problem is that if something is patented to the camera it will not interact with anything, are you trying to create some kind of cutscene? If it’s that and you need the camera to follow the bullet then you would do something like:

local followPosition = bullet.Position
local cameraPosition = camera.Position
while true do
cameraPosition = followPosition
cameraPosition = cameraPosition.Position.X - 10
wait(0.01)
end

Thsi script is not tested and probably doesn’t work, basically it SHOULD make the camera hav an offset of -10 studs from the bullet in the X axis, and follow the bullet

No problem, if you ever need me in here!

1 Like

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