I am a beginner to Lua. So, for now, this is a simple script for a pandora's box using a click detector. If you click it, it is supposed to print "hello". However, "hello" is not being printed.
function onClicked(playerWhoClicked) script.Parent.ClickDetector.MouseClick:connect(onClicked) print("hello") end
You're calling the event line:
script.Parent.ClickDetector.MouseClick:connect(onClicked)
within the function, when it should actually be after the function instead.
Like this:
function onClicked(playerWhoClicked) print("hello") end script.Parent.ClickDetector.MouseClick:connect(onClicked)
I'm not entirely sure what calling the event using that function, inside the function, would do aside from recursive behavior... otherwise, your code is just fine, just a little rearranging is all that is needed
PS: Also cite errors from the output if you get any, they usually help in knowing where your problem lies