I have a trouble of making a dash script. Sounds embarrassing but the problem isn’t the movement, in fact it is easy to make a movement on the client.
The problem is that I have a question: Do you need to, for example, have a request to the server that checks for cooldowns/states and if something is wrong - cancel the dash on the client? Or you can completely trust the client.
It is the problem that is stopping me from continuing to make the other technical stuff like Evasive, IFrames on Front/Back dash, and a hitbox when using Front Dash, since I don’t know If I need to cancel the dash/perform actions if anything on the server fails.
Track cooldowns and whatnot on the server and client, add in some ping compensation and then lock the player in place for X seconds if they are dashing too quickly as well as sending a ping to the client to stop dashing.
Personally I like to keep all movement on the client where I can as it’s far more responsive and snappy, but it’s still a smart idea to implement sanity checks where you can as well.
For example, have 2 trackers going for dash, one for client and the other for server. The client can remain snappy while the server can still stop the player from doing anything if they aren’t playing legitimately.
You could also try using server authority but it is a nightmare to work with.
It all depends on how your movement system is set up.
Case 1: If you do not have any kind of custom scripts that validate the player movement, such as transferring the authority and handling all of the movement on the server side. You can easily do the dash on the client side, while handling the cooldown on the server side. This will not stop any hacking behavior as the default Roblox movement is relying on the client side in the first place. In other words, hackers will be able to dash/fly/noclip without your dash mechanic regardless. Handling the cooldowns on the server is just a good practice as the server will have the most relevant information that you can use in other scripts. Thus, not secure, but the Roblox movement is not secure by default anyway.
Case 2: You have a complete server authority on the movement. In other words, the client is not able to move themselves, the character model is not in the client’s authority, and the client rather sends the input to the server, which is then handled to move the character. In such case, you should handle the dash on the server side, as any other movement in your game. Best possible approach, but requires your custom movement setup.
Case 3: You have the default Roblox movement with the client as a source of truth, but you have some kind of anticheat on the server side to validate the movement. In this case, you should handle the dash on the server side with the anticheat allowing this action instead of detecting and punishing it. In this case, the hacker will still be able to dash themselves, but this will be caught by your anticheat. And only the server side dash will be whitelisted for the client.
Ideally, you want your game to be the Case 2. This is how the movement is done in almost all of the games outside of Roblox. However, this requires deep scripting knowledge and experience. I would recommend you the Case 1, moving to Case 3 as your scripting knowledge grows. Hope that helps!
That’s leads me to the question: do you need to cancel dash on the client in case if server cooldown is still off, or if any “sanity check” is being failed on the server?