I’m trying to code a custom Health bar, Stamina bar and Strength bar in my game.
Here’s what they look like for context:
The issue is that up till now I have only been working with the camera, gui’s and animation which aren’t really exploitable. I would like to make them as secure as possible from the get go.
A basic idea I have is to handle the animations of the gui locally and set the values of the Player (health, walkspeed) from the server. I have looked into remote events and functions but I didn’t understand them fully yet so I would appreciate if someone knows some resources worth looking into for this scenario or maybe a different way to handle it.
What I want to know is how could I make it less exploitable. For example, at first I thought of doing everything in a local script, but players could mess with the values inside that and achieve speed hacking
The filling and unfilling is not of concern since I could just use a tween when the player starts and stops sprinting
What about the Stamina value, shouldn’t the player in theory be able to achieve infinite sprint if they mess with the variables in the script, because I wouldn’t want them to do that, since it would ruin a lot of the gameplay for other players.
Constantly have the server manage a player’s sprint by sending a RemoteEvent to activate and deactivate the sprint. I don’t recommend this since server latency can become a problem for the general experience.
Have the server check every X amount of seconds how long the player has been running for past the normal WalkSpeed. Lets say at most, a player can sprint for 8 seconds. But the server detects a speed that lasted for 10 seconds. It’s safe to assume the player is cheating. Then, you can act however you’d like.