Hidden leaderstats source code

  1. Datastore methods such as :GetAsync() or :SetAsync() will occasionally fail so you should wrap them in a pcall

  2. Your using :SetAsync on a .Changed event for multiple players which will put heavy load unto the datastore from multiple calls so fast. You can fix this by simply just using :SetAsync() when the player leaves or have your datastore save all the players data in a 1 minute interval loop.

  3. Using the parent parameter in Instance.new(“Classname”, Parent) is slower than just setting the parent property after setting all the other properties. More info on that here

  4. You can do += on your points value to increase

Other than that the script is fine