I don’t believe using remote events would be any safer than putting it directly on the client, as your lack of sanity checks on the server means that the client could literally modify its runspeed anyways and you’d have no way to knowing.
If the entire sprinting/movement system is on the client, then you’re making it a lot easier for exploiters to… exploit, with remote events you can perform sanity checks on the server and on the data of the remote event as well as set a quota so that if it’s activated too quickly (by an exploiter attempting to crash the server or something like that) you can kick or ban them simply because, unless it’s bad code then a normal player wouldn’t be able to do that.
If you do decide to use RemoteEvents, I recommend implementing some sort of floodchecking solution, with ofc checks on the server. I’d encourage doing sprinting and other movement systems on the client, and if you do, one idea you could look into is a confirmation system, where whenever your movement script applies a change, it notifies the server with it’s exact parameters, so the server is able to distinguish what’s done by your system and what’s not.
yeah honestly i don’t really know what to do at this point
using remote events will crash the stock market of players with worse internet, and will make sprinting have delay since client->server communication
not using remote events will not crash the stock market of players with worse internet, but will make the code very easily exploitable
but then again, if someone really is speed cheating, there’s always a votekick function, even though most of roblox is not competent enough to know what a votekick is, it should get rid of obvious speedcheaters
there’s a lot of factors that play a role in this
the bigger problem arrives when there are movement speed buffs and debuffs, some are from certain passive buffs that come with your perk, some come from stims (or consumables in general) and some come from rng along with combat
If you want to stop or heavily limit it, then just check if the player is moving too fast or for too long while they are supposed to be spriting on the server. Be generous of course to account for potential latency issues. And teleport them back to where they were earlier if they exceed it. You could dynamically handle this based on their buffs (+ tolerance), or just set it to the maximum by default to only affect the obvious cheaters. You won’t need remote events for this since you would be directly using player positions.
(This could if course depending on your game get too complex to be practical, but at that point you don’t really have many options other than what you’ve already stated)
i looked at the code @SaintImmor gave me, i didn’t yoink it, i just got inspired from it
the code uses attributes to do walkspeed and sprintspeed, those attributes get changed by the server from stims and perks only, the client can STILL modify those attributes locally
Yes, though you could also potentially infer it from speed changes if you wanted. The event is easier and won’t be a problem since you are just telling the server the clients intent to help you get more fine grained control over what you are measuring. You shouldn’t trust it blindly though.
You could also consider the leaky bucket limit for speed as a way to put limits and tolerance as @tlr22 said.
Stamina is similar to regening mana as it is done continuosly or in bursts hence the tolerance metaphorically described as the bucket.
Ideally the standard is chickyoid with server sided movement but tbh its complicated and may not be compatible with your game but worth a look (Im limited in this area).
for more complex or larger games you will have a finite state machine, which may or may not require a ‘sprinting’ state.
the server and the client state machines synchronize their states, and with this you make any sprint logic for the server and client.
Speed change, animations and visuals should always be done in the client for immediate feedback.
Even the Roblox templates don’t use remote events for sprinting neither dashing, double jump, high jump or any fancy velocity/speed usages. The newest template “Platformer” doesn’t and the upcoming ones never will. They care mostly for parameter sanity checks which could clog the server if not treated properly.
The front-page games which have a running feature lack server delay, hinting that their run/sprint system is also client-side.
The client has nearly absolute ownership over physics. Anti exploits or sanity checks for walk speed doesn’t seem worth it. And would only increase complexity if you have stack based buffs that affect walk speed.
Make use of state machines for whatever logic needed on the server.
For this type of situation the remote event should be an unreliable remote event that only take the responsibility of replicating sound and visual effects and perhaps other custom logic that vary depending on the game.
Sorry for taking long to reply. I want to make sure the information I provide can guide you and other readers.
Everything that can be modified by the client should be done on the client (cheaters can change their walk speed, why bothering making the sprint script on the server)