ClickDetector after clicking on it does, well, nothing

After clicking on ClickDetector from the distance, it does, well, nothing.
Snímka obrazovky 2023-05-21 092207
I am also clicking from the set distance.
Code:

local clickDetector = script.Parent
local function onClicked()
	print("onClicked")
	game.Players.LocalPlayer.PlayerGui.TalkCampman.Enabled = true
end

-- Connect the function to the MouseClick event
clickDetector.MouseClick:Connect(onClicked)

P.S. Never done ClickDetector before, so dont mock me.

Did u make sure that click detector is in an part and u are in the range of it

Yes.
Snímka obrazovky 2023-05-21 092742
Snímka obrazovky 2023-05-21 092811

LocalScripts do not work in the workspace.

Instead try using a Regular Script with the RunContext set to Client

1 Like

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