Skip to content
← Back to Community
Autoclickers.
Profile icon
CoolGuy27

I have made this repl, and I would like to add autoclickers to it. How would I do this?

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
KevinChen125
Profile icon
CoolGuy27
Comments
hotnewtop
Profile icon
Coder100

setInterval is your friend :)

setInterval(() => { x += 2; }, 1000)

In this example, x (inside your clicker game, I presume that is your score) gets added by 2 every 10 seconds.

Profile icon
CoolGuy27

@Coder100 yes, thanks so much!

Profile icon
Coder100
Profile icon
Baconman321

XD

window.setInterval(()=>{document.getElementById('button').click();},1);

paste that into console and oof, no clicking today XD hacks

Profile icon
CoolGuy27

@Baconman321 oof, how would I fix this?

Profile icon
Baconman321

@CoolGuy27 You can't since it's javascript people can just automatically set an interval through dev tools that clicks the id of the button. If you can do it, they can do it (it's fun anyways, and the if you show it to non-coders, it should be fine)

Profile icon
CoolGuy27

@Baconman321 ok, I was just wondering.
(this is gonna rock for my beta testers)

Profile icon
Baconman321

@CoolGuy27 XD, I just made an interval that buys a coding buddy every 1 seconds, I climb up like 1k every second now, and everything XD (make that 10k)

Profile icon
Baconman321

@CoolGuy27
Screenshot 2020-10-21 at 12.52.14 PM
-fun XD
*Imagine the feeling in your fingers after writing that many lines of code XD (even with tons of coding buddies) * XXD

Profile icon
Baconman321

Just make code that automatically ups the the score using https://www.w3schools.com/jsref/met_win_setinterval.asp window.setInterval();