Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make a click to get something simulator?

Asked by 4 years ago

My game isn't released so I'll just say u get something every time u click. I'm worried that the remote events will get throttled if I keep firing remote events. Will that happen and then delay lag will happen? I haven't tested it yet but I have 10 players as max. I do know how to code it but will firing remote events everytime cause lag?

1 answer

Log in to vote
1
Answered by
Scarious 243 Moderation Voter
4 years ago

To answer your question, yes, firing remote events excessively will cause lag. Especially if one of your players decides to use an auto clicker. gasp

Anyways, you can get around this by doing everything that you would normally do when a player clicks, except store a value for the amount of times a player clicked. Then, have a while wait(1) do loop which checks if the clicks > 0, and if they are, fire your remote event.

This limits the amount of remote events fired by a single player due to clicks to 1, and the total of the server to 10. Which should not cause lag.

I also recommend calling math.min(clicks, 12) on the server when it receives the clicks, because the chances of a player clicking more than 12 times without an autoclicker is unlikely. I used to do badlion pvp on Minecraft, and maxed out at around 13-14.

0
AAAAY u do minecraft pvp too? but that doesn't feel too secure HappyTimIsHim 652 — 4y
0
What do you mean it doesn't feel to secure? Scarious 243 — 4y
0
ohhhhh u shoulda told me to change it locally and loop it to match the server so it feels smooth but anyways u gave me the loop idea so th HappyTimIsHim 652 — 4y
Ad

Answer this question