I want to make a script that can detect various things.
Detect when someone chats
Detect when someone clicks
Detect when someone jumps
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.
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?
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)
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.