How do I get the player from mouse button1 with normal script?

I am making a purchase button on a surface GUI and I have a normal script, how do I find the player?

local MarketPlaceService = game:GetService("MarketplaceService")

local devProductId = xxxx

	print("Detected click")
1 Like

MouseButton1Click only works on the client, in which you can grab the player anywhere in the script with game.Players.LocalPlayer

1 Like

When I do it from client, it won’t print when I use the same thing yet, the normal script will?

LocalScripts cannot run in the workspace. Move the script to either StarterGui, StarterCharacterScripts, or StarterPlayerScripts. Make sure that you change script.Parent to reference the StarterGui (ie. workspace.Part_With_Gui.SurfaceGui.TextButton)

1 Like

That is not possible a players mouse can only be accessed from a local script. Sorry about that.