All in one script

I want to make a script that can detect various things.

  1. Detect when someone chats
  2. Detect when someone clicks
  3. Detect when someone jumps
  4. More…

How could I include this detection in one script? I know how to easily detect chat messages with the function but Idk how I could include clicks and jumps aswell cuz then I would need to make it into a localscript for clicks.

(this is for a achievement game)

2 Likes

A singular script couldn’t detect when an event like that happens. You’d need to account for all events through separate functions.

I would recommend handling the counters on the back end as trusting the client as to whether or not they’re moving / chatting can and will be an issue regarding exploiters. Lastly, for your “click” counter are you referring to just any clicks in general? Or are you referring to a ui that would pop up a player would have to click that?

1 Like

Any click just click anywhere on the screen

That’s the only case where I’d say that you would use remote events. Though, make sure to implement a delay in the backend to prevent exploiters.

so for the clicking you are going to need to use a local script with a remote function, as for the jumping well that depends. It would probably be best performance wise to track that via the client, but if you dont want people exploiting it then yes use the server, you can track it I think like this but dont quote me:

local hum = YOURHUMANOIDHERE
hum:GetPropertyChangedSignal("Jump"):Connect(function()
     if hum.Jump then
           print("PLAYER JUMPED")
     end
end)
2 Likes

Performance generally shouldn’t be an issue as you’d need to call the server anyway. I’m suggesting a reasonable denounce in between each jump, as you’d have to use remote events anyway to grant any kind of reward.