Why Click Detector don't work on models cloned?

Hello,
I have created a shop and I need to add a click detector for the items in the shop but it doesn’t want to work. It’s like don’t want to detect my mouse cursor.

in the video, I am clicking on the model but it doesn’t want to detect.

https://streamable.com/xojmhc

4 Likes

It is because it is in a folder. Try the same thing with UI, add a frame inside a folder and try to select it.

1 Like

ok I see
so I need to change the folder to a Frame something like that?

No, the model / gun is inside a folder inside workspace, meaning that you can’t select it nor interact with it. I suggest whenever you open your item shop you put it in workspace and when you close it you put it back inside your folder. You understood me wrong, I was just giving an example, you can’t select or interact with - Parts - in a model or a folder and - UI in a folder.

1 Like

ok :ok_hand:
thanks man
and if the Humanoid of the player is not near the model, is it still going to work?

I have trouble understanding what are you trying to achieve…

no, it is fine
nvm what I say I will go try to put the models in the workspace thanks

Ok, so I tested something else and ignore what I said above about the folder thing, even if you have a folder it works perfectly fine, the problem is that it measures your HumanoidRootPart’s distance between the part and the MaxActivationDistance depends on it. So putting the MaxActivationDistance property of the ClickDetector to something high or just teleporting the player to the gun and he would be able to click it.

ok so wait I am going to stand near the shop and try to test it
and I will send a video

image
image
https://gyazo.com/32af912e27da9f42f1274c16053fa5e3

So basically what you need to do is raise the ClickDetector’s MaxActivationDistance or bring the player closer to the hitbox of the part.

3 Likes

now its detecting but not working
btw I am clicking on the model
https://streamable.com/hu3c37

The pistol is still inside the folder so i think that’s what @Ubicast meant.

yes but no after he test it and find that its work when its in a folder

At this point, I’m guessing you have something messed up in your code. By this point it should work. The folder was not the problem @SiebeYolo, it was the MaxActivationDistance at first but right now I’m only guessing it could be the code or something else.

I dont know the script its fine
check this
I did some tests

https://streamable.com/uaxv41

Yeah, i’m having the same feeling. I thought it was just the folder thingy (as i’m not very experienced with clickdetectors) but this is indeed strange.

2 Likes

so there is no solution for my ClickDetector problem?

At this point I don’t know what is happening and why won’t it work. Maybe because something is covering the gun? The camera part is blocking the click? (This should not be the problem because even with CanCollide off you can still click it.) So I wanted to try and experiment a little bit by trying to re-create what he made. Took the camera, made the camera type attached and the camera subject to a camera part and tried to click the other part. Everything works perfectly fine. So at this point I’m clueless, I’m sure there is a solution to this but not that I know of. I would also like to hear other people’s thoughts on this.

https://gyazo.com/e82ff12677745e1566edfbdd5d4d678e

hey btw just for information all my weapons have a “Mesh” is this the problem?
is the Mesh blocking the click?

Screenshot (181)

I don’t think it is the mesh, I took the same model that you have (or at least I think) and it is a part with a mesh inside it, so I just put in a click detector and a script and it works normally. So yea I don’t know what could your problem be.

image

The title is not the problem just to get that out of you way.

script.Parent.ClickDetector.MouseClick:Connect(function()
    print("Clicked...")
end)

This is what I used to test ^