Skip to content
Sign upLog in
← Back to Community
ATTENTION: Scoreboard API
Profile icon
hacker
has Hacker Plan
amasad

You can use this to create and persist a scoreboard for your game.

It's very simple:

  1. include a script in your app <script src="https://scoreboard--amasad.repl.co/scoreboard.js"></script>

  2. You'll get a global object scoreboard

  3. scoreboard.submit\({username: 'playerNameHere', score: numberScoreHere}\)

  4. List the scoreboard using scoreboard.list\(\).then\(topTenScores => console.log\(topTenScores\)\)

The script is smart enough to create a board for your game (it's domain-based) so it's very easy to use. End to end example here: https://repl.it/@amasad/scoreboard-example

Here is the source code for the service if anyone is interested https://repl.it/@amasad/scoreboard 😉

Voters
Profile icon
JacobMcPherson1
Profile icon
avibeskrowni
Profile icon
Allum_c
Profile icon
ash15khng
Profile icon
rechutox
Profile icon
DARKLORD6474
Profile icon
DarkBlueWall
Profile icon
HaydenSanchez
Profile icon
ddiioonn123
Profile icon
Vandesm14
Comments
hotnewtop
Profile icon
BobTheTomatoPie

someone has hacked repl and is spam tagging users, I am VERY pissed off right now as every time i am pinged it sends me an email, i have been pinged over 2000 times in the past 4 hours. If you do not fix this i swear to god i will quit repl

Profile icon
amasad

@BobTheTomatoPie
we have a fix on the way, sorry about that.

Profile icon
BobTheTomatoPie

im have never been more happy from a ping, thank you so much man

@amasad

Profile icon
numcomx

i really like that creates the board based on domain :)

Profile icon
amasad

@numcomx
: thanks for noticing, I decided that the API should be as simple as possible.

Profile icon
JSer

You missed a ) at the end of the fourth point

Profile icon
amasad

@iamcaleblol
: fixed! Thanks

Profile icon
numcomx

i think is awesome the api was made with GO lang :)

Profile icon
amasad

@numcomx
: we love go at Repl.it, fun fact that our infrastructure, that runs all your code, is written in Go

Profile icon
numcomx

@user23802991
: awesome :)

Profile icon
JSer

People can hack the scoreboard using the Developer tools (Ctrl + Shift + i) and type scoreboard.submit\({username: 'Their Names', score: 10000000000}\) in the console 😂😂😂
(You can see that I hacked into your scoreboard demo)
image

Profile icon
Calamari1

@iamcaleblol
: Really securing a leaderboard is pretty hard, if you have both front and back totally open source (inclusive the secrets)

Profile icon
amasad

@iamcaleblol
: lol yes, not sure how we can secure it though. You can do that with Firebase or any other clientside data API. Open to ideas.

Profile icon
JSer

If a player wants to submit his score multiple times, how can I make it so it can delete his previous scores?

Profile icon
amasad

@iamcaleblol
: I made it so that it picks the highest score.

E.g.

  1. amasad scored 10
  2. amasad scored 8 (it's still 10 because it's higher)
  3. amasad scored 12 (it will register 12 because it's the highest)

Does it make sense?

Profile icon
JSer

@user23802991
: OK Thanks

Profile icon
amasad

@iamcaleblol
: Let me know if you want to reset the data or delete something and I'll do it for you

Profile icon
itbarsoum

wow great assistant to games

Profile icon
bradenrueter

HTML5 <crying emoji>

Profile icon
426729

Does this work in just a normal HTML file that you open on your computer?