How would I go about making blocking in a combat system

So, im currently making a combat system of my own, but I’m having a bit of a problem with how I would go about making the blocking portion of the system.

So when the player spawns they have a folder that contains all the values of the combat system(IsBlocking, IsStunned, etc) in their character, made server-sided of course.

Now for the blocking value, I was thinking that if the player presses the block key which is F, there is a remote event that is sent to the server editing the block value inside their character. Now the problem with this is that since there is a delay on the speed at which the remote event can be sent to the server, the player could have delay issues. Giving the player that is attacking a unfair advantage.

How would I go about tackling this issue, and if this is the wrong approach for this then what should I do?

1 Like

There should be no delay/very minimal delay which is not noticeable if you are using remove events. We cannot help you further without some code too.

1 Like

I haven’t wrote the code for the blocking portion yet, because I’m trying to figure out what approach to this would be the best. Also, would this delay be based upon the ping the player has?

Yes and no. If a player has 500 ping, everything will be laggy so it really won’t have a major effect. Also, you can use Bindable events to remove the latency if you wish. I don’t see a problem with both bindable events and remote events.

How are you able to remove latency with Bindable Events? Bindable events can only be used for server-server and client-client communications

only way i can see it able to eliminate the blocking delay is to handle the damage on the blocking players client side but then its open for exploits

Yea of course. Allowing all of that on the client side is like asking for your game to be hacked

Hmmmmm. the one way I could think of is checking the player your hitting to see if they currently have the block animation playing, since animations are pretty much built in replicated it’d be pretty snappy… but of course this should work in theory

@KeegansPerun Also bindable events don’t remove any sort of latency, it can’t be avoided in any sort of online setting with players in different locations

So what im thinking is remote event to set block to true, and then when the other player attacks I check if the hit is valid on the server and if the player has blocking active on the server. This would send a lot of remote events, so im not sure if this would cause the player to lag.

Well when you are sending data from the client to the server or from the server to the client ping will always be an issue of course if it’s on the higher end like > 150ms, but when you block make it happen instantly on the client for the instant feedback, and then let’s say another player is attacking, so they detect that player and before you fire any sort of remote events to handle damage, on that client check if that player is playing the block animation; this will allow you to do immediate effects for that client aswell, but of course this is just in theory

But if you do end up implementing this it would make your game feel very nice even on higher ping

2 Likes

Alright thank you, this has clarified things for me.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.