The whole script is the problem, it’s messy, inefficient, and why are you making leaderstats in a localscript? Not to mention, the leaderstats is not even a folder, its an intvalue.
I don’t recommend making everything in one script, especially not with this. Since some part of that script are supposed to be in a localscript and some a serverscript.
If you’re talking about the MouseButton1Click, then no. You could do for example Player.PlayerGui.ScreenGui.TextButton.MouseButton1Click:Connect(function() end) You wouldn’t have to though but I also don’t recommend doing everything on the server to be fair, some things are more performance friendly on the client.
No, the player would be clicking the button that is located in player gui not starter gui, also how would you get the player that clicked the button, you would need to loop through each player and connect the function, unless you fire a remoteevent from a localscript when the player clicked the button which is easier. and also you can’t get mousebutton1click from a server sided script, and I don’t see why you would do that, I see why you would fire from a local script but not from a server script.
You can’t fire anything from StarterGui anyways, since it’ll get cloned into PlayerGui as you said. You can get MouseButton1Click from the server. Try it out :), some people do it though.
I still don’t see why you would do that, it’s easier to fire from a localscript when the player clicks the button to the server and not the other way around. And you most definitely CAN fire from startergui