Click Detector not working

Cant figure out why it wont work. I am clicking it and it wont print.

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

image
any and all help is appriciated.

4 Likes

Hey @KufoDev,

can you try out if this script works?

local clickDetector = script.Parent
 
function onMouseClick()
	print("Clicked!")
end
 
clickDetector.MouseClick:connect(onMouseClick)
1 Like

Didnt work sadly,
I might try and make an alternative method.
I cant really think of why it wont work as I tested it in a empty baseplate and it worked fine.

1 Like

could you show us your Output?

1 Like

There isnt one, Its really weird. I click it and absolutely nothing happens.

1 Like

Where is the BasePart located?

1 Like

This problem has also been happening to me, idk why MouseClick is not working, but i find another solution, which is using mouse.Button1Down and mouse.Target

local Players = game:GetService("Players")
local Plr = Players:GetPlayerFromCharacter(character)
local mouse = Plr:GetMouse()

mouse.Button1Down:Connect(function()
    if mouse.Target == "Part" then
       --Your code here!
    end
end)


-- / If you want to have a MaxDistanceActivation like ClickDetector do: /--

local char = Plr.Character or Plr.CharacterAdded:Wait()
local hum = char:WaitForChild("HumanoidRootPart")
local range = workspace.Part.ClickDetector.MaxActivationDistance

function Distance()
    local distance = (hum.Position - workspace.Part.Position).Magnitude

    return distance
end

mouse.Button1Down:Connect(function()
    if mouse.Target == "Part" and Distance() <= range then
        --Your code here!
    end
end)

I hope this can help you with your problem c:

You might disabled your script or you forgot to check the part’s archivable properties equal to true

Are you within the clickdetector range when you clicked it?

Try identifying the player when doing so.

script.Parent.MouseClick:Connect(function(player) 
print("CLicked") 
end)

Bruhh, you forgot to do the’s,

local part = game.Workspace.Part

part.ClickDetector.MouseClick:Connect(function()
	print("clicked")
end)

This is wrong. script.Parent is already referencing the ClickDetector, no need to add a .ClickDetector.

but, it works!, and the other script, doesen’t, work,
thes, is right, if you see closer, you need to add the part to, not only like the clickdetector!

No it doesn’t work, try it with the same hierarchy.

The other script is the only one that does work, how misinformed are you? Have you even tested the other script? I just believe that the OP disabled the script or put it in a place where Scripts don’t run.

ok, i well try it whit the same, and it well work!

and, its not only

script.Parent.MouseClick:Connect(function()

beacuse, you need to call the part to!, not only the ClickDetector!
also, see

See the’s,


then, say it works, or not!
script:

local part = game.Workspace.Part

part.ClickDetector.MouseClick:Connect(function()
	print("clicked")
end)

See, it works, and you also need the Part
not only the ClickDetector!
See, it works how misinformed are you, the other script i try, them but dint work it was an error!

1 Like

Your script is literally different than the one you showed earlier. You’re more arrogant than anyone I’ve seen. Especially at your experience level I would expect you to be more respectful.

1 Like

bruh, i changed the, script beacuse the parent was the part, not the ClickDetector!,
and i dint saw it i tought the part was the parent.

1 Like