Click detector not firing click event

I’ll get right into the problem; the click event just doesn’t fire. I only have this in the entire script:

script.Parent.ClickDetector.MouseClick:Connect(function()
	print('clicked')
	if #workspace.AI:GetChildren() >= 5 then return end
	
	local AI = game.ReplicatedStorage.AI:FindFirstChild(script.Parent.Name):Clone()
	AI.Parent = workspace.AI
	AI:SetPrimaryPartCFrame(workspace["Practice Gym"].Court.GameObjects.AISpawn.CFrame)
end)

The clicked print won’t even work and I don’t think the event is even firing.

Image of my explorer:
image

The only thing I can think of that is interfering is that the surface gui is somehow blocking the clicks.

Before anyone asks:
MaxActivationDistance is set to 32.
The properties are the default ones.
The cursor appears like I can click it but the event never fires.

  1. Are there any errors?
  2. Does the AI model have a PrimaryPart?

No errors, and yes, the AI Model is a normal rig with a primary part.

Does it print at all? If not, perhaps you’ve set it up wrong.

Its not printing at all, I don’t exactly understand how its set up wrong though. I tried using wait for child and variables but that didn’t give any different results…

Seems to be working fine for me when I copied your setup.
Is that the full code? (seems unlikely).

Yes thats the entire code. I honestly don’t know why the event won’t fire. The script is exactly 9 lines long

Where’s the part located, and do you get the clickable mouse icon when hovering over it?

The part is located within a model rooted inside 3 folders. The mouse does show that I can click it.

Since I can’t replicate your issue, I’m assuming it’s something else you’ve done wrong.
I can’t tell you what, though.

Is the script enabled, does the script run at all? Try adding a print(‘hello’) at the top of your script.

The script is running. Could it be that my camera is locked in the game? The player can’t zoom out more than 15 studs so maybe thats the issue

That is not the issue.
Make a free-model of your model, and I’ll investigate further if you’d like.

I assume scripts cannot work in ReplicatedStorage, try putting it somewhere else.

The scripts are a descendant of workspace.

I’ve uploaded it.

It runs fine for me? I don’t see the problem.
Perhaps you have a virus in your game, or something that prevents it from running.

I haven’t used any freemodels so I doubt its a virus. All of my plugins are legit.

What could keep a click detector event from running?

Perhaps another script is disabling it.
I can’t really help you as I don’t understand what causes this in the first place, as it works fine for me.

I think I might have figured it out. My game uses context action service to bind something to the MouseButton1, I think the click detector won’t work due to that. Guess I’ll have to figure out a method to bind and unbind it throughout gameplay.