Hello! i made a sprint script with stamina which is all run client sided. Its pretty simple and works great, when the player is running stamina starts falling and if they are not running or standing still their stamina starts to regen. Stamina also falls by a little when the player jumps.
Like i said this is all client sided so if a exploiter wanted to they can edit the constants and give themselves max stamina. I could move it to the server but the client could also just edit their walk speed to the run limit and also have infinite stamina in a way. It could be prevented on the server using a runservice event constantly updating their walk speed to the walk speed constant while they are not running. But this could also interfere with other scripts changing their walk speed.
So both ways have pros and cons and i like the simplicity of it all being client sided but i want your opinion for this.
Client
Server
0voters
Video:
(sorry for the recording lag the website made it like this)
Exploiters can simply bypass this by modifying their CFrame so you should
also consider trying to counter it if you were to decide
adding into the server
Example:
local root = game:GetService("Players").LocalPlayer.Character.HumanoidRootPart
local rs = game:GetService("RunService")
rs.RenderStepped:Connect(function()
root.CFrame = root.CFrame * CFrame.new(2,0,2)
end))
-- This is an simple example of how they would bypass this.
-- In actual scripts, the multiplier would change depending on the walk direction
This right here. Tbh, if cheating lets someone have more fun with a game, more power to them, but if them cheating hurts the other players’ experience with it, that’s when it becomes a problem.
If you think they may be able to grief other players with a mechanic (or messing with it really damages the overall experience), it’s better to make the server handle most of the important stuff.
Otherwise, the more stuff that can be handled on the client, the better. Means less tax on the server.
If you really really don’t want them to sprint because it could give them infinite money (eg distance to money game) then do it on the server and on the server make a loop that store their position and on the next iteration, calculate the distance they traveled by subtracting the stored position and the current position and get the magnitude of that. Then you check if walk speed + 4 (margin of error) correspond to the distance traveled in delta (if the speed is 24 stud per sec, if you travelled 2 studs is .2s then it’s going 10 studs a sec and is within limit of 28 stud/s)
Trying to make it a shooter game, running isnt the core mechanic just a way to get around. How would i implement this to the server as well? I would obviously fire a remote but how would i just safely make sure they arent running when they arent supposed too?
Thats usually how my anticheat goes, simple magnitude heartbeat loop which checks the time between positions. Might consider just continuing with that and move it to the server too.
I have had a solution which is my reply above. The only way this could get through is if they are modifying their position by a very small margin but that defeats the point of them using this exploit in the first place.