How far can i trust client?

Can i trust client at charging let’s say ability? (If the time passed is greater than needed it’d fire an ability remote else if time calculated on client is lower then i’d fire normal attack) or do i have to do sanity checks on server (if so then how, cause with the delay it’s hard to calculate time from client to server and so on)

You can never trust that any of what the client sends you is correct data. For an ability, I would do the logic on both sides. On the client to ensure fast response, and then a check on the server to make sure it is correct. As far as I know, there logically shouldn’t be an issue with enough time having passed on the client but not on the server when the event gets there.

Keep the logic in both, save when the remote was called on the server, otherwise you could get people spamming an ability every .1 seconds or something

I got a delay for that, they’d just be able to call the ability faster. When i tried using this it was very unreliable so that’s why i am asking

Using a lot of delay() on the server is not the best thing, does work though, i’d save a Table with the tick() the remote was fired on

For example, cooldowns[player.UserId]=tick() cooldowns just being a table and player gotten from the remote event

Then when the event is called if (tick()-cooldowns[player.UserId]) > abilityCooldown then

if true do the thing, if false debounce

Oh i meant like debounce thing with the “delay” word, not task.delay even tho i use this often as well

Anyway, can i calculate the latency somehow?

Turns out there’s a function for that, even i didn’t know this existed, Player:GetNetworkPing()

Yeah, i don’t know the usage of it yet, lemme find some examples then

Update: I managed to make probably the most accurate latency formula (accurate up to 1/1000 or even more), soo yeah i don’t have to trust the client now