What's the best way of handling attacks in my case?

I’m working on a game with 5 other people. And I’ve only just added attacks yesterday, but I can’t think of a secure way to handle damage from the attacks. All attacks are ran on the client (vfx only), If I were to handle damage on the client, then exploiters could just abuse that to kill the entire server.

1 Like

When a client wants to attack, ask the server first and process the damage on the server. No matter how many requests the client sends, you can manage it on the server using a delay and since it is being done on the server, the client cant mess with any damage variables since they are stored server side.

1 Like

remote event/function

Summary

This text will be hidden

PS: You physically cant deal damage on the client, cause that means that only one person would see it, AKA the client, everyone else would be fine.

I need the damage to actually replicate to other players, and remote events can be abused. So I don’t know what to do

ok here we go.
Step number one, when a player activates an attack it sends a remote event to the server, that just tells the server what kind of attack to use. Next the server checks if the player can use this attack such as, making sure the attack isnt on cooldown, has the right item or whatever for said attack etc.

The server than checks to see if the attack hits anyone, and then deals damage, whilst thats going on the server sends and event to all clients to display and VFX or SFX.

When dealing with server client always and I mean ALWAYS make checks on the server.

This won’t really work because of how the games scripted.

well then, how is it that this wont work? If the game is scripted in a way that this wont work then it should probably be rescripted.

How much are you handling on the client for these attacks right now?

explain the attack logic, like from skill use to the player hit taking damage

1 Like

You can use the hit box code on the client, and detect if someone has touched the hit box using
loop function using GetPartsInBox.
If it turns out that someone is inside the hitbox.
RemoteEvent sends a signal, and check again in the server script.

This system is made in games such as battleground, for the most for the smoothest gameplay and more accurate reading.

If you want, I can write you the code

1 Like