Doesn't recognize clicking textbutton on a part

Hello! This is really basic but I’m just not sure why it isn’t working.

So I have a part in my game with some UI inside it including a textbutton. However the problem is I can’t get the button to register when it’s clicked. The same code works outside of the part but won’t work when put inside a part. Is there something I’m missing?

This is the code I have (local script):

script.Parent.MouseButton1Click:Connect(function()
	print("test")
end)

LocalScripts do not work in the workspace, review Documentation here for any valid containers.

Your alternative is to:

  • Add a regular Script
  • Set RunContext to Client
1 Like

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