✓ Accepted answer
Okay, so here is what I assume is happening here.
You have a ClickDetector that is a descendant of Workspace. Parented to said ClickDetector is a LocalScript that has no actual client associated with it.
Well, the LocalScript is the problem. LocalScripts won't run if they don't have a client associated with them. The exception to this rule is a player's Character located in Workspace. Because the Character is associated with a player (aka a client), any LocalScript that is parented to that Character will run, but any LocalScript parented to an NPC will not.
Server communication with a player's camera is not acceptable because FilteringEnabled will prevent it from happening. In order to alter the player's camera, either a RemoteEvent or RemoteFunction should be used so that the ClickDetector on the server can communicate with the player that clicks on the ClickDetector.
You may have not known this before, but MouseClick passes a player argument when it fires, meaning that the first parameter given will have a userdata value that points to the player:
script.Parent.MouseClick:Connect(function(p)
Using the FireClient() function of a RemoteEvent or the InvokeClient() function of a RemoteFunction, you can communicate with the player passed by MouseClick:
event:FireClient(p)
func:InvokeClient(p)
6 comments
What is your script parented to?
Click detector
If you use that LocaScript inside of Workspace then It can't run. Change the script parent to...StarterGui
@bostaffmanbulgaria1 Not that kind of script, it's a local script for a click detector
It needs to be a Script not a localscript.
script.Parent.MouseClick:Connect(function(playerWhoClicked) the player who clicked is passed implicitly as a parameter