✓ Accepted answer
So I'm unsure of the full context of this, but you're using this in a weird way.
A few points I need to make. This should be in a local script. MouseButton1Click is something that will be handled on the client, and as such belongs in a local script. With that established ask yourself a few things.
Is this in a local script?
Is the local script on the client? Client meaning somewhere on the client like "ClientScripts" or "PlayerGui" or even the backpack.
My second point. Since you should be using this in a local script, the easiest way to find the player is to do:
game.Players.LocalPlayer
That will give you your player, and should be the same player used to click the mouse button, since it's local.
Another thing. I'm not sure that "MouseButton1Click" actually has anything it will send when fired. The wiki doesn't appear to have anything.
If you want some more help, check out roblox's wiki:
https://developer.roblox.com/en-us/api-reference/event/GuiButton/MouseButton1Click
Hope this helps.
2 comments
That happens because the normal server script can't get the player who clicked it, you will need a local script and a server script with remotes and stuff to get the actual definition of plr
Use a clickdetector, problem solved.