I've got a mechanic, but I don't quite know how to implement it

Hello!

I’m making a dodgeball-type game, and I thought it’d be really cool to have a catching mechanic. The whole idea of this catching mechanic is when a ball is coming at you, you can press G and it throws you into a quicktime event in which you need to press 8 keys to catch the ball. This was working really well until I got to the matter of actually implementing it. I thought I would check for balls within a certain area around the player and then they could press G to fire a remote… etc. But, the ball travels way too fast and I can’t exactly cast that far in front of the player.

If anyone has any ideas on how I could implement this, please let me know!
If you need any videos, etc. just let me know as well.
Thanks!

1 Like

This can be tricky to implement depending on your worries. If you aren’t worried as much on the cheating/Exploiting end. You can manage everything on the client and tell the server that User (A player) caught the ball.

Although, worrying about exploiters is a valid concern so I will add a better solution to that. You could have the client say that they are trying to catch the ball (Check if the ball is in a correct state or position for catching) Have the server return a random sequence of keys. Send remote events for each key pressed. The Server will check if the key is correct. Do that for all 8 keys. If all are correct. Have the server manage the ball catching.

1 Like

Thanks for the reply, but I don’t think I explained it quite right. I have the entire catching mechanic complete and working with security measures as well. The only issue is, the idea was that the player has the option to catch a ball coming towards them. This would fire a remote to the server telling it that the player requested a catch. But, the ball is moving too fast, and I don’t want to slow it down because that would significantly lower the quality of the throw mechanic itself. I could use further shapecasts but that comes with many more complicated components such as direction calculation and predictive components. I’m looking for a better way to implement this system into my overall game.

1 Like

In that case you could use Script Communication on the client. Using Variables the _G variable or shared variable. If using BetterSignal or GoodSignal you should be able to send signals. This will send a signal to the catching mechanic. If that is done and the ball is close enough and the is pressing g button is true then run the ball catching mechanic. Keep the ball catching keybind for as long as the timing you want it to be. Example: you could have the TriedToCatch variable to true for 0.5 seconds. Meaning they would have to press the G button atleast 0.5 seconds before the ball hits them to catch it.

As I said, the whole system works. It’s just an issue with the prompt itself - the ball moves so fast that by the time the player hits G the ball already hit them. It sounds like the ball is moving really fast but it actually isn’t, and then I’d have to account for the slight delay on remotes.

The scripts work fine, I used a mixture of callbacks and my own signal module I made. I tend to steer clear of _G and shared.

You could use module scripts instead of using _G. Call the function when the user presses G. Have it set a variable for X amount of time based on your Timing for catching. Next, if the ball touches the player. Check if the Variable is true for if the user pressed G. If so Catch the ball.

Since the ball is moving so fast. You are probably going to have to rely on some pre-calculations.